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:8481fdad87cd135acae0
Last active August 29, 2015 14:24
Useful chrome internals
# For all configuration
chrome://about
Slow DNS lookups - For some reason site.local is a really slow lookup
chrome://net-internals/#dns
chrome://net-internals/#events
// Copy big file from somewhere else
$src_filepath = 'http://example.com/all_the_things.txt'; $src = fopen($src_filepath, 'r');
$tmp_filepath = '...'; $tmp = fopen($tmp_filepath, 'w');
$buffer_size = 1024;
while (!feof($src)) {
$buffer = fread($src, $buffer_size); // Read big file/data source/etc. in small chunks
fwrite($tmp, $buffer); // Write in small chunks
}
@carltondickson
carltondickson / gist:66cdd9293ce0cd694a7b
Last active August 29, 2015 14:23
MySQL toggle query logging
nano ~/.bash_aliases
alias mysql_turn_on_query_logging = "mysql -h localhost -uroot -p -e \"SET GLOBAL log_output = 'FILE'; SET GLOBAL general_log_file='/tmp/mysql_general.log'; SET GLOBAL general_log = 1;\""
alias mysql_turn_off_query_logging = "mysql -h localhost -uroot -p -e \"SET GLOBAL general_log = 0;\""
@carltondickson
carltondickson / gist:a7f0f74f81fb82dd0ab9
Last active May 25, 2016 12:59
Ubuntu shortcuts - PHPSTORM SUBLIME
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon[en_GB]=bash
Name[en_GB]=PhpStorm 9 - EAP
Exec=/bin/bash /home/carlton/programs/PhpStorm-141.1224/bin/phpstorm.sh
Name=PHPStorm
Icon=/home/carlton/programs/webide.png
@carltondickson
carltondickson / gist:14c9b7b84c9eb3aead4a
Created May 27, 2015 11:39
Git commit that introduced a string in any branch
# http://stackoverflow.com/a/5816177/682754
git log -S <whatever> --source --all
@carltondickson
carltondickson / gist:e5d3194f7383b40bc076
Created May 22, 2015 10:40
Search text strings in files
# Search text strings in all files in a folder
grep "test" /var/www/
# Recursively
grep -R "test" /var/www/
# Install Java 7 JDK and create an alias if needed
alias selenium_start='java -jar ./selenium-server-standalone-2.48.2.jar'
# Useful notes "codeception/codeception": "~2.0"
The AcceptanceTester parameter passed into the tests is a class that is generated dynamically, if web driver is used as a module then the web driver functions will be available in the auto complete
# Running tests in general
http://codeception.com/docs/02-GettingStarted#Running-Tests
# Running tests for specific environments
@carltondickson
carltondickson / gist:235b05c56df9670b3959
Created April 28, 2015 09:21
Composer - Require specific version of a package
composer require "foo/bar:1.0.0"
# IP address
ip.addr == 10.43.54.65
ip.src == 10.43.54.65 or ip.dst == 10.43.54.65
@carltondickson
carltondickson / gist:e68795d7f224b02034ce
Last active August 29, 2015 14:19
Linux - Find only files in a folder
find /tmp/brightcove-cache/ -type f | wc -l