Friday, December 20, 2013

Quote by Bob Dylan

“You better start swimming or sink like a stone, cause the times they are a-changing.” - Bob Dylan

Monday, December 2, 2013

Quotes by Leo Tolstoy

"The two most powerful warriors are patience and time" - Leo Tolstoy
"The sole meaning of life is to serve humanity" - Leo Tolstoy

Friday, November 15, 2013

Efficiently Delete Large Files

rsync  -a --delete /home/empty_dir/ dir_7/

find . -type f -exec ionice -c3 rm {} \;

Wednesday, November 13, 2013

Quote by Leo Tolstoy (#1)


"Everyone thinks of changing the world, but no one thinks of changing himself" - Leo Tolstoy

Saturday, November 2, 2013

Quote - by Jonathan Ive

"There's no learning without trying lots of ideas and falling lots of time" - Jonathan Ive

Quote - by Patti Smith

"In art and dream may you processed with abandon. In life may you processed with balance and stealth" - Patti Smith

Monday, October 28, 2013

Quote - by Aldous Huxley

"I wanted to change the world. But I have found that the only thing one can be sure of changing is oneself" - Aldous Huxley

GIT: Atlassian cheat sheet

Here is link to GIT cheat sheet. Click here to download it

Thursday, October 24, 2013

Friday, October 18, 2013

.vimrc file for Drupal



set term=xterm-color
syntax on
"set background=dark " adapt colors for background
":colorscheme evening
set t_vb=
"set nowrap
set expandtab
set tabstop=2
set shiftwidth=2
set autoindent
set smartindent
set ruler
set number
"setlocal spell spelllang=en_us

" Use vim defaults.
set nocompatible

" Set filetype detection on, load plugins and indent.
filetype plugin indent on

set history=3000
set title
set matchtime=2
set showmatch
set showcmd " show commands while they're being typed
set t_Co=256

" Bells and whistles.
"set novisualbell
"set noerrorbells

" Backup.
set nobackup " Don't backup files.
set nowritebackup
set noswapfile

set hlsearch " Highlight searches
set incsearch " Search incrementally
set ignorecase " Ignore case
set smartcase " Set case
set wildmode=longest,list " File and directory matching mode.

" Diff opt
set diffopt=vertical

if has("autocmd")
" Drupal *.module and *.install files.
  augroup module
  autocmd BufRead,BufNewFile *.module set filetype=php
  autocmd BufRead,BufNewFile *.install set filetype=php
  autocmd BufRead,BufNewFile *.test set filetype=php
  autocmd BufRead,BufNewFile *.inc set filetype=php
  autocmd BufRead,BufNewFile *.profile set filetype=php
  autocmd BufRead,BufNewFile *.view set filetype=php
  augroup END
endif

" Highlight chars that go over the 80-column limit
:highlight OverLength ctermbg=black ctermfg=red
:match OverLength '\%81v.*'

" " Highlight redundant whitespaces and tabs.
highlight RedundantSpaces ctermbg=red
match RedundantSpaces /\s\+$\| \+\ze\t\|\t/

let php_sql_query = 1
let php_baselib = 1
let php_htmlInStrings = 1
let php_parent_error_close = 1
let php_noShortTags = 1

"let php_folding = 1

" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
  au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
    \| exe "normal! g'\"" | endif
endif

screen: move cursor to beginning and end of a line

beginning of like: Ctrl-A a

end of line: Ctrl-e 

Monday, August 19, 2013

Youtube videos to MP3

youtube-dl https://youtube.com/?v=id_here
ffmpeg -i id_here.flv -acodec mp3 file.mp3

Monday, August 5, 2013

Remove a user account from Ubuntu



1. Open a terminal

2. Delete user  'sudo /usr/sbin/userdel username'

3. Delete user home directory ''sudo rm -r /home/username//''

Tuesday, July 30, 2013

.screenrc file

# # Example of a user's .screenrc file # # This is how one can set a reattach password: # password ODSJQf.4IJN7E # "1234" # no annoying audible bell, please vbell on # detach on hangup autodetach on # don't display the copyright page startup_message off # emulate .logout message pow_detach_msg "Screen session of \$LOGNAME \$:cr:\$:nl:ended." # advertise hardstatus support to $TERMCAP # termcapinfo * '' 'hs:ts=\E_:fs=\E\\:ds=\E_\E\\' # make the shell in every window a login shell #shell -$SHELL # autoaka testing # shellaka '> |tcsh' # shellaka '$ |sh' # set every new windows hardstatus line to somenthing descriptive # defhstatus "screen: ^En (^Et)" defscrollback 100000 # don't kill window after the process died # zombie "^[" ################ # # xterm tweaks # #xterm understands both im/ic and doesn't have a status line. #Note: Do not specify im and ic in the real termcap/info file as #some programs (e.g. vi) will not work anymore. termcap xterm hs@:cs=\E[%i%d;%dr:im=\E[4h:ei=\E[4l terminfo xterm hs@:cs=\E[%i%p1%d;%p2%dr:im=\E[4h:ei=\E[4l #80/132 column switching must be enabled for ^AW to work #change init sequence to not switch width termcapinfo xterm Z0=\E[?3h:Z1=\E[?3l:is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l # Make the output buffer large for (fast) xterms. termcapinfo xterm* OL=10000 # tell screen that xterm can switch to dark background and has function # keys. termcapinfo xterm 'VR=\E[?5h:VN=\E[?5l' termcapinfo xterm 'k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~' termcapinfo xterm 'kh=\E[1~:kI=\E[2~:kD=\E[3~:kH=\E[4~:kP=\E[H:kN=\E[6~' # special xterm hardstatus: use the window title. termcapinfo xterm 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007' termcapinfo xterm 'hs:ts=\E]2;:fs=\007:ds=\E]1;screen\007' #terminfo xterm 'vb=\E[?5h$<200>\E[?5l' termcapinfo xterm 'vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l' # emulate part of the 'K' charset termcapinfo xterm 'XC=K%,%\E(B,[\304,\\\\\326,]\334,{\344,|\366,}\374,~\337' # xterm-52 tweaks: # - uses background color for delete operations termcapinfo xterm ut # pgup pgdn for xterm termcapinfo xterm*|rxvt* 'ti@:te@' ################ # # wyse terminals # #wyse-75-42 must have flow control (xo = "terminal uses xon/xoff") #essential to have it here, as this is a slow terminal. termcapinfo wy75-42 xo:hs@ # New termcap sequences for cursor application mode. termcapinfo wy* CS=\E[?1h:CE=\E[?1l:vi=\E[?25l:ve=\E[?25h:VR=\E[?5h:VN=\E[?5l:cb=\E[1K:CD=\E[1J ################ # # other terminals # #make hp700 termcap/info better termcapinfo hp700 'Z0=\E[?3h:Z1=\E[?3l:hs:ts=\E[62"p\E[0$~\E[2$~\E[1$}:fs=\E[0}\E[61"p:ds=\E[62"p\E[1$~\E[61"p:ic@' # Extend the vt100 desciption by some sequences. termcap vt100* ms:AL=\E[%dL:DL=\E[%dM:UP=\E[%dA:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC terminfo vt100* ms:AL=\E[%p1%dL:DL=\E[%p1%dM:UP=\E[%p1%dA:DO=\E[%p1%dB:LE=\E[%p1%dD:RI=\E[%p1%dC ################ # # 256 colours # # ... http://frexx.de/xterm-256-notes/ # # terminfo and termcap for nice 256 color terminal # allow bold colors - necessary for some reason attrcolor b ".I" # tell screen how to set colors. AB = background, AF=foreground termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' # erase background with current bg color defbce "on" #term "screen-256color" #term "screen-88color-bce" #term "screen-256color-bce" #term xterm ################ # # ssh-agent support # # http://www.jukie.net/~bart/blog/screen-ssh-agent # unsetenv SSH_AUTH_SOCK setenv SSH_AUTH_SOCK "$HOME/.screen/ssh-auth-sock.$HOSTNAME" ################ # keybindings #remove some stupid / dangerous key bindings bind k bind ^k bind . bind ^\ bind \\ bind ^h bind h #make them better bind 'K' kill bind 'I' login on bind 'O' login off bind '}' history # Yet another hack: # Prepend/append register [/] to the paste if ^a^] is pressed. # This lets me have autoindent mode in vi. register [ "\033:se noai\015a" register ] "\033:se ai\015a" bind ^] paste [.] ################ # default windows # screen -t local 0 # screen -t mail 1 elm # screen -t 40 2 rlogin faui40 ################# # # caption/hardstatus # http://jinome.stanford.edu/stat366/unix/.screenrc # caption always "%3n %t%? @%u%?%? [%h]%?" # hardstatus alwaysignore # hardstatus alwayslastline "%w %H" # caption always "%{Yb} %Y-%02m-%02d %0c %{k}|%{C} %LD %{k}|%{G} %l %{k}|%{W} %-Lw%{+u}%n %t%{-u}%+Lw" caption always "%{Yb} %D %Y-%02m-%02d %0c %{k}|%{G} %l %{k}|%{W} %-w%{+b}%n %t%{-b}%+w"

SSH Timeouts

1. In your home directory, edit  the .ssh/config (create one if it doesn’t exist)
2. Add the following two lines:
  a. KeepAlive yes
  b. ServerAliveInterval 60
3. Save the file.

Tuesday, July 16, 2013

Wednesday, July 10, 2013

Create New User - MySQL



CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
FLUSH PRIVILEGES;


Thursday, June 27, 2013

focus@will

I stumble upon ad free service of classical music call https://www.focusatwill.com/music/#player.
They also provide application for Android (Nexus 7)

See screenshot below

Google Reader shutting down

Few months ago Google announced that Google Reader project would cease to exist... I'm testing free RSS services including:
http://www.goread.io/
http://www.newsblur.com/
http://theoldreader.com/

Wednesday, June 26, 2013

Increase group_concat function length

SET SESSION group_concat_max_len = 1000000; // SESSION
SET GLOBAL group_concat_max_len = 1000000; // GLOBAL
// Advance group_concat (order and separator)
group_concat(name order by name separator ':') from users;

For more information Click Here

Monday, April 22, 2013

How to determine MySQL database engine?

SELECT 
  table_name,
  engine 
FROM 
  INFORMATION_SCHEMA.TABLES WHERE table_schema=DATABASE();

Tuesday, April 2, 2013

How to kill 'screen' tab or session

Window
1. C-a 
2. :kill 
3. Enter

Session
screen -S 23534 -X quit

Screen reference can be found here

Thursday, March 21, 2013

Delete Git branches (local or remote)

git fetch -p # sync local branches with remote
git branch -D my_branch # Local delete
git push origin :my_brach # remove branch remotely

Wednesday, March 13, 2013

Coursera: An Introduction to the U.S. Food System: Perspectives from Public Health

I earned 97.9% grade on "An Introduction to the U.S. Food System: Perspectives from Public Health". The couse was interesting and informative for me. I have "Statement of Accomplishment".

Wednesday (4 lines)

Sunday, February 24, 2013

Food words (meaning and origin)

I was watching lecture on Coursera "An Introduction to the U.S. Food System" and stumble upon 3 words that I found interesting:
 - trivia (tri - three, via - road). Trivia originated in ancient Rome
 - companion (com - with, panion - bread).
 - board (Viking word means table) 

Monday, February 4, 2013

Condominium (3 Years!)

I just realized that 3 years ago I purchased my condominium. I went through very difficult time dealing with NYC Department of Buildings. I like my apartment and the area.

Thursday, January 31, 2013

Average File Size in Directory

find print/ -type f -print0 | xargs -0 ls -l | gawk \ '{sum += $5; n++;} END {print "Total Size: " sum/1024/1024 " MB : Avg Size: " sum/n/1024 " KB : Total Files: " n ;}'

Tuesday, January 29, 2013

Clearing cache for druplal node

cache_get('content:12345:23456', 'cache_content'); # get the data cache_clear_all('content:nid:vid', 'cache_content') # clear that specific nid/vid combination cache_clear_all('content:nid', 'cache_content', TRUE) # clear all cached revisions of that nid

Then vs. Than

Then - is another word for “after.” Incidentally, the word “then” makes for boring writing.
Than - is a comparative word (e.g. I am smarter than you).

Wednesday, January 2, 2013

How ti import CSV file into MySQL table


LOAD DATA INFILE "file.csv"
INTO TABLE __source_data
COLUMNS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
ESCAPED BY '"'
LINES TERMINATED BY '\n';

OR

LOAD DATA INFILE "/home/mike/data.csv"
INTO TABLE my_TABLE
COLUMNS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
ESCAPED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 LINES;