Skip to content

Instantly share code, notes, and snippets.

View sergeycherepanov's full-sized avatar
:bowtie:
Focusing

S.Cherepanov sergeycherepanov

:bowtie:
Focusing
View GitHub Profile
@sergeycherepanov
sergeycherepanov / gist:d0bbc50fb3b3496fe7bd
Last active August 29, 2015 14:05
GIt deployment script
#!/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
GIT=/usr/bin/git
USER=www-data
GROUP=www-data
BASE_DIR="/var/www"
HTML_DIR="public_html"
GIT_DIRNAME=".git"
LOG_FILENAME="deploy.log"
ME=`whoami`
windows only:
install cygwin with ssh and rsync
add c:\cygwin\bin to PATH environment variable
mac osx only:
sudo port install libiconv @1.14_0+universal
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
tar xvfz libiconv-1.13.1.tar.gz
cd libiconv-1.13.1
@sergeycherepanov
sergeycherepanov / wg-to-ps.sql
Created October 20, 2014 06:28
Minecraft - Convert cuboids data from WorldGuard to PreciousStones
INSERT INTO
`minecraft_ps`.pstone_cuboids (
`parent`,
`x` ,
`y`,
`z`,
`world`,
`minx`,
`maxx`,
`miny`,
@sergeycherepanov
sergeycherepanov / select-tables-size.sql
Created September 3, 2015 19:12
Finding out largest tables on MySQL
SELECT CONCAT(table_schema, '.', table_name), \
CONCAT(ROUND(table_rows / 1000000, 2), 'M') rows, \
CONCAT(ROUND(data_length / ( 1024 * 1024 * 1024 ), 2), 'G') DATA, \
CONCAT(ROUND(index_length / ( 1024 * 1024 * 1024 ), 2), 'G') idx, \
CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 * 1024 ), 2), 'G') total_size, \
ROUND(index_length / data_length, 2) idxfrac \
FROM information_schema.TABLES \
ORDER BY data_length + index_length DESC \
LIMIT 10;
For Debian, sysbench is hard to beat. It's a simple 1-2-3:
Install
sudo apt-get install sysbench
Prepare
sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --mysql-password=yourrootsqlpassword prepare
MYENVVAR="world" salt-call state.template test.sls
mysql -uroot -proot pradam_new -e "show tables" | grep ^customer_ | awk '{print "delete from "$0";"}' | mysql -uroot -proot pradam_new
mysqldump --no-create-info --single-transaction --skip-triggers -uroot -p pradam $(mysql -uroot -proot pradam -e "show tables" | grep ^sales | tr '\n' ' ') > sales_tables.sql
http://brew.sh - The missing package manager for OS X
https://www.iterm2.com - iTerm2 is a replacement for Terminal
https://tunnelblick.net - free software for OpenVPN on OS X
https://github.com/jimbojsb/launchrocket - A Mac PreferencePane for managing services with launchd
http://www.sequelpro.com/ - MySQL Database Management for Mac OS X
https://itunes.apple.com/us/app/copyclip-clipboard-history/id595191960?mt=12 - Clipboard History Manager
https://monosnap.com - Free Screenshot snd Screencast Tool
http://www.kekaosx.com - Archive tool
http://bindfs.org/ - bind local folder