Skip to content

Instantly share code, notes, and snippets.

@djburdick
djburdick / gist:5027714
Created February 25, 2013 04:16
move posterous code posts to gists. #ruby
require 'open-uri'
require 'nokogiri'
def scrape
29.times do |i|
page = i + 1
url = "http://djcode.posterous.com/?page=#{page}"
doc = Nokogiri::HTML(open(url))
@djburdick
djburdick / gist:5027657
Created February 25, 2013 04:00
Adding and editing sudo users . #linux
/etc/sudoers
username ALL=(ALL) ALL
#
Open this file:
@djburdick
djburdick / gist:5027656
Created February 25, 2013 04:00
Altering mysql table . #mysql
alter table change field_name field_name int(11);
@djburdick
djburdick / gist:5027655
Created February 25, 2013 04:00
Showing all linux users . #linux
cat /etc/passwd
cat /etc/passwd | grep home
@djburdick
djburdick / gist:5027654
Created February 25, 2013 04:00
php config . #php
/etc/php.ini
#
PHP config file is here usually:
@djburdick
djburdick / gist:5027653
Created February 25, 2013 04:00
Changing/setting the date on linux . #linux
date -s 12/8/2009 12:58:30
@djburdick
djburdick / gist:5027652
Created February 25, 2013 04:00
Linux Top cheatsheet . #linux
us = user cpu
sy = system cpu
id = idle CPU (high is good)
wa = I/O wait (either RAM or disk. High here means prob not a cpu issue)
Mem: free + Swap cached = actual free RAM
iostat
#
Load average is the last: 1, 5 and 15 minutes.
@djburdick
djburdick / gist:5027651
Created February 25, 2013 04:00
linux iostat cheatsheet . #linux
iostat
tps: transaction per second
Blk_read/s: blocks read per second
Blk_read: total block read
Blk_wrtn: total blocks written
iotop
#
Use iostat to check for high disk bound load.
@djburdick
djburdick / gist:5027650
Created February 25, 2013 04:00
ssh passwordless (keyed) login . #linux
ssh-keygen -t dsa
scp id_dsa.pub username@example.com:~/.ssh/authorized_keys2
ssh-add
exec ssh-agent bash
@djburdick
djburdick / gist:5027649
Created February 25, 2013 04:00
linux find a file . #linux
$ find / -type f -name filename