Export notes from old Evernote *.exb file to csv

EXB is and SQLite3 database file.
Just use bash script to export all the tables to csv


# obtains all data tables from database
TS=`sqlite3 $1 «SELECT tbl_name FROM sqlite_master WHERE type=’table’ and tbl_name not like ‘sqlite_%’;»`

# exports each table to csv
for T in $TS; do

sqlite3 $1 <

Make a list of similar urls like www.example.com/page=10

1. Make a column of incrementing numbers
:put =range(1,50)
Use Ctrl+V to select the first column of text in the lines you want to comment.
Then hit Shift+i and type the text you want to insert. (www.example.com/page=)
Then hit Esc, wait 1 second and the inserted text will appear on every line.

исправить кодировки имен файлов Ubuntu

sudo apt-get install convmv
find . -type f -print -exec convmv —notest -f -t {} \;

UPD: Неприятный случай с «doubly-encoded to utf-8 from iso-8859-5»

import os
for root, dirs, files in os.walk("./", topdown=False):
for name in files:
allfiles.append(os.path.join(root, name))

for f in allfiles:
newf=f.decode('utf8').encode('latin1').decode('utf8', 'replace')
print "{} is in proper encoding".format(f)
os.rename(f, newf)
print "{} decoded well".format(f)

vim hints

Write lines to file — :start_line_no,end_line_no w filename
Delete till the end of line — D
Delete till the beginning of line — d0
Paste at the end of line — $p
Show all files open -:ls
Go to middle of line — gm

batch ods to xls and backwards

Как сконвертировать много файлов из OpenOffice Calc в Excel и обратно

*.ods-> *.xls
libreoffice —headless — invisible —convert-to xls *.ods

libreoffice —headless —invisible —convert-to ods *.xls

2 вариант : unoconv

sudo apt-get install unoconv

unoconf -f xls *.ods

dict to class — рекурсивно

# convert a dictionary to a class
class Struct(object):
def __init__(self, adict):
"""Convert a dictionary to a class

@param :adict Dictionary
for k, v in adict.items():
if isinstance(v, dict):
self.__dict__[k] = Struct(v)

def get_object(adict):
"""Convert a dictionary to a class

@param :adict Dictionary
@return :class:Struct
return Struct(adict)