Skip to content

Instantly share code, notes, and snippets.

View jfountain's full-sized avatar

James Fountain jfountain

View GitHub Profile
@jfountain
jfountain / gist:1278734
Created October 11, 2011 17:22
Geany extra options for global search to exclude svn and cache
--exclude-dir=.svn --exclude-dir=cache
@jfountain
jfountain / gist:1288004
Created October 14, 2011 19:06
Ban ip via iptables
sudo iptables -I INPUT -s 123.1.1.1 -j DROP
@jfountain
jfountain / gist:1288015
Created October 14, 2011 19:08
List iptables by line number
sudo iptables -L -n --line-number
@jfountain
jfountain / gist:1640535
Created January 19, 2012 15:13 — forked from lucasfais/gist:1207002
Sublime Text 2 - Raw Shortcuts
super+shift+n new window
super+shift+w close window
super+o prompt open file
super+shift+t reopen last file
super+alt+up switch file
super+n new file
super+s save
super+shift+s prompt save as
super+alt+s save all
super+w close
@jfountain
jfountain / gist:2046384
Created March 15, 2012 19:45
Restore a deleted file from svn
svn copy -r [version #] [svnurl]@[version #] .
@jfountain
jfountain / gist:2061186
Created March 17, 2012 15:27
Delete iptable rule by rule number
iptables -D INPUT {rule #}
@jfountain
jfountain / gist:2208884
Created March 26, 2012 19:19
Block Ip Range with iptables
sudo iptables -I INPUT -s 138.162.8.0/24 -j DROP
@jfountain
jfountain / gist:2418589
Created April 19, 2012 04:36
update guest addition for virtualbox
wget -c \
http://download.virtualbox.org/virtualbox/4.1.12/VBoxGuestAdditions_4.1.12.iso \
-O VBoxGuestAdditions_4.1.12.iso
sudo apt-get install build-essential linux-headers-`uname -r`
sudo mount VBoxGuestAdditions_4.1.12.iso -o loop /mnt
sudo sh /mnt/VBoxLinuxAdditions.run --nox11
rm *.iso
@jfountain
jfountain / gist:2991671
Created June 25, 2012 22:07
Get only column names from mysql
select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='table'
@jfountain
jfountain / gist:3057155
Created July 5, 2012 23:44
memcache tester
public function action_memcache(){
$memcache_enabled = extension_loaded("memcache");
dump("Memcache enabled: ".$memcache_enabled);
//memcached simple test
$memcache = new Memcache;
$memcache->connect('localhost', 11211) or die ("Could not connect");
$key = md5('9000'); //something unique
for ($k=0; $k<5; $k++) {
$data = $memcache->get($key);