Skip to content

Instantly share code, notes, and snippets.

View carltondickson's full-sized avatar
🏠
Working from home

Carlton carltondickson

🏠
Working from home
  • Carlton Dickson Development Ltd.
  • London
View GitHub Profile
@carltondickson
carltondickson / gist:288772c69ce479d99673
Created July 1, 2014 14:27
Creates SQL that retrieves all tables and row counts for a given schema
SELECT CONCAT(
'SELECT "',
table_name,
'" AS table_name, COUNT(*) AS exact_row_count FROM ',
table_schema,
'.',
table_name,
' UNION '
)
FROM INFORMATION_SCHEMA.TABLES
cd ~/Downloads
# IE8 - Windows XP
wget -i https://az412801.vo.msecnd.net/vhd/VMBuild_20131127/VirtualBox/IE8_WinXP/Linux/IE8.WinXP.For.LinuxVirtualBox.txt
# IE8 - Windows 7
wget -i https://az412801.vo.msecnd.net/vhd/VMBuild_20131127/VirtualBox/IE8_Win7/Linux/IE8.Win7.For.LinuxVirtualBox.txt
# Give execute permissions
chmod +x ./IE8*.sfx
@carltondickson
carltondickson / gist:bddf76faf86370f17d14
Created August 11, 2014 16:41
Show contents of a git stash
git stash show -p stash@{0}
@carltondickson
carltondickson / gist:6180f965ad22474cf1a9
Last active August 29, 2015 14:05
Mysql - Character and collation settings
# Defaults, log in to command line and run these...clients like SQLYog may have already SET NAME utf8 so results would not necessarily show the defaults
SHOW VARIABLES LIKE "collation_database";
+--------------------+-------------------+
| Variable_name | Value |
+--------------------+-------------------+
| collation_database | latin1_swedish_ci |
+--------------------+-------------------+
SHOW VARIABLES LIKE "%character%";
@carltondickson
carltondickson / gist:b14d72d9d3631f870c48
Last active March 26, 2023 15:18
mysqldump export and zip
# Exporting entire database:
mysqldump -u user -p database --opt | gzip > database.sql.gz
# Export table
mysqldump -uroot --opt --databases DB_NAME --tables TABLE_NAME | gzip > /tmp/TABLE_NAME.export.sql.gz
# Importing:
gunzip < database.sql.gz | mysql -u user -p database
# Credit http://failshell.io/mysql/using-gzip-and-gunzip-with-mysql-to-importexport-backups/
@carltondickson
carltondickson / gist:f53c9e675a3d3e35366e
Created August 13, 2014 16:24
MySQL select certain data into data dump
# Following needs the file permission, double check you look on the DB server to find the outfile!
SELECT .. INTO OUTFILE '/home/foo/myfile.csv'
# If no file permission try command line instead
mysql -e "SELECT * FROM foo ORDER BY bar" > '/path/to/file'
@carltondickson
carltondickson / gist:04a296dfccf7a2207447
Last active August 29, 2015 14:05
scp - copy from remote to local
# Auto-complete works if you have ssh keys set up to the server
scp user@homeip:/path/to/file /local/path/
# Credit http://superuser.com/questions/337776/how-do-i-scp-from-remote-machine-to-local-machine-when-i-am-outside-of-my-home-n
@carltondickson
carltondickson / useful.sql
Last active February 3, 2016 09:51
MySQL useful queries
# Show running queries
SHOW FULL PROCESSLIST;
# Show who is connected
SHOW STATUS LIKE '%onn%';
# Search stored procedures for a string
SELECT * FROM information_schema.`ROUTINES` r WHERE r.`ROUTINE_DEFINITION` LIKE '%string%';
@carltondickson
carltondickson / gist:d62a01a1e45822cfa0ea
Last active August 29, 2015 14:07
Profiling options for PHPStorm configuration
Create new run configuration with following "Command Line > Interpreter Options" or add the options after "php" on the command line
/usr/bin/php -d xdebug.profiler_output_dir="/tmp/profiler" -d xdebug.profiler_enable_trigger=1 -d xdebug.profiler_enable=1
Ref: http://confluence.jetbrains.com/display/PhpStorm/Profiling%20PHP%20applications%20with%20PhpStorm%20and%20Xdebug
@carltondickson
carltondickson / gist:53c362475eba16ae4227
Created November 13, 2014 11:39
Reduce compiz memory usage Ubuntu
# From http://askubuntu.com/questions/82684/lowering-compiz-memory-usage#answer-82698
# Kill compiz completely, including all child processes, freeing it's memory:
killall -9 compiz &
# Run unity and give you back a free terminal.
unity & disown