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 / 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;
@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`,
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 / 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`