This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" for creating gists | |
Plugin 'mattn/webapi-vim' | |
Plugin 'mattn/gist-vim' | |
"""""""""""""""""""""""""""" | |
" GIST Options | |
"""""""""""""""""""""""""""" | |
" If you set g:gist_clip_command, gist.vim will copy the gist code with option '-c' | |
let g:gist_clip_command = 'xclip -selection clipboard' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Quickly edit/reload VIMRC configuration file | |
nnoremap gev :e $MYVIMRC<CR> | |
nnoremap gsv :so $MYVIMRC<CR> | |
if has ('autocmd') " Remain compatible with earlier versions | |
augroup vimrc " Source vim configuration upon save | |
autocmd! BufWritePost $MYVIMRC source % | echom "Reloaded " . $MYVIMRC | redraw | |
autocmd! BufWritePost $MYGVIMRC if has('gui_running') | so % | echom "Reloaded " . $MYGVIMRC | endif | redraw | |
augroup END | |
endif " has autocmd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# directories to be included, space separated | |
SOURCE="/home/chewie /etc" | |
# directories to be excluded, space separated | |
IGNORE="/home/chewie/Downloads /home/chewie/Steam" | |
DRIVE_FOLDER="duplicity-backup" | |
LOGFILE=/home/chewie/duplicity.log | |
# set email to receive a backup report | |
EMAIL="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Issue: | |
Unexpected end of file perhaps the fastcgi process died lighttpd | |
Solution: | |
Check lighttpd cgi config. | |
For more info refer: https://www.cyberciti.biz/tips/lighttpd-php-fastcgi-configuration.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The easiest way would be to allow arbitrary text in front of the match, and specify the matched region using \zs: | |
:%s/.*\zsone/two/ | |
To change a line till the last of occurence of word 'one' in it | |
c/.*\zsone/e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* How to alter a column and change the default value in MYSQL ? */ | |
ALTER TABLE foobar_data MODIFY COLUMN col VARCHAR(255) NOT NULL DEFAULT '{}'; | |
/* A second possibility which does the same (thanks to juergen_d): */ | |
/* --------------------------------------------------------------- */ | |
ALTER TABLE foobar_data CHANGE COLUMN col col VARCHAR(255) NOT NULL DEFAULT '{}'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# =========================================================== | |
# Convert PDF to image with high resolution | |
# =========================================================== | |
convert -density 300 -trim test.pdf -quality 100 test.jpg | |
# =========================================================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
======== | |
VIM TIPS | |
======== | |
Adding a block of code inside a function in all opened buffer | |
------------------------------------------------------------- | |
// Disable literals | |
$this->setup(array('phqlLiterals' => true )); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to fix: “UnicodeDecodeError: 'ascii' codec can't decode byte” | |
# ----------------------------------------------------------------- | |
# Add the below code in the heading of python file | |
import sys | |
reload(sys) | |
sys.setdefaultencoding('utf8') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 74 supplied | |
# You need to pass in a sequence, but you forgot the comma to make your parameters a tuple: | |
cursor.execute('INSERT INTO images VALUES(?)', (img,)) | |
# Without the comma, (img) is just a grouped expression, not a tuple, and thus the img string is treated as the input sequence. If that string is 74 characters long, then Python sees that as 74 separate bind values, each one character long. | |
>>> len(img) | |
74 |
OlderNewer