Skip to content

Instantly share code, notes, and snippets.

TheMengzor /
Created Sep 28, 2017
Dump all MySQL databases in separate files
export PASSWORD=""
mysql -uroot -p$PASSWORD -e 'show databases' | while read dbname; do mysqldump -uroot -p$PASSWORD --complete-insert --some-other-options "$dbname" > "$dbname".sql; done
cat <<EOF
This utility will find <Search> string and replace it with <Replacement> string
in all files in current folder including their both filename and contents
# check if GNU rename utility exists
if [ ! -f /usr/local/bin/rename ]
TheMengzor / gist:968e5ea87e99d9c41782
Created Nov 28, 2014
BASH Absolute path of current script
View gist:968e5ea87e99d9c41782
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

Is a useful one-liner which will give you the full directory name of the script no matter where it is being called from

These will work as long as the last component of the path used to find the script is not a symlink (directory links are OK). If you want to also resolve any links to the script itself, you need a multi-line solution:

while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
View .vimrc
" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" allow backspacing over everything in insert mode
TheMengzor /
Last active May 17, 2017
CLI speedtest
curl -fsSL | python -
TheMengzor / ssh.add.a.plist
Created May 11, 2017
View ssh.add.a.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
View gist:8cb568b7ebb1a2bbc52c14d391dd428e
open -na /Applications/ --args -DataPath "/Users/$(whoami)/Library/Application Support/Skype ANODA"
TheMengzor /
Last active Oct 25, 2016
Letsencrypt installation
cd /etc/httpd
mkdir /etc/httpd/sites-available
mkdir /etc/httpd/sites-enabled


IncludeOptional sites-enabled/*.conf
View .screenrc
termcapinfo xterm ti@:te@
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' # Tell screen how to set colors. AB = background, AF=foreground
hardstatus alwayslastline
hardstatus string '%{= w}%-w[ %{= g}%n %t%{-} ]%+w%=%{=b r}%H%{-} %{= Y}%l%{-} %{=b m}%d.%m.%Y %c:%s%{-}'
nethack on
scrollback 20000
defscrollback 20000
altscreen on