This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# determine interfaces in promiscuous mode (ie sniffing) | |
ifconfig | grep PROMISC | |
# DNS lookup, reverse lookup | |
nslookup | |
# List all processes, for all users | |
# UID PID PPID C STIME TTY TIME CMD | |
ps -afx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat > histfile <<DOC | |
echo a | |
echo b | |
echo c | |
DOC | |
# run a new shell to clear out history artifacts | |
sh | |
history -cr histfile | |
!1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ip_to_hex() { | |
dec=$(echo "$1" | tr '.' ';') | |
hex=$(echo "obase=16;$dec" | bc) | |
printf "%02x%02x %02x%02x\n" 0x$hex | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To run, export RUBYOPT so that it applies the patch before invoking rake: | |
# | |
# export RUBYOPT='-rpatch' | |
# rake -h | |
# rake -T | |
# rake -- cmd_echo a b | |
# | |
# | |
# Part 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'rest_client' | |
request = 'http://denver.craigslist.org/search/cta?query=accord&srchType=T&minAsk=8000&maxAsk=20000&hasPic=1&s=%s' | |
page_min, page_max = ARGV | |
(page_min.to_i...page_max.to_i).each do |page| | |
puts RestClient.get(request % page) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby --version | cut -d ' ' -f '1 2' | tr ' ' - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir example | |
cd example | |
rvm exec ruby --version | |
# jruby 1.5.6 (ruby 1.8.7 patchlevel 249) (2010-12-03 9cf97c3) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_24) [x86_64-java] | |
# jruby 1.6.1 (ruby-1.8.7-p330) (2011-04-12 85838f6) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_24) [darwin-x86_64-java] | |
# rubinius 1.2.4dev (1.8.7 a81a80db yyyy-mm-dd JI) [x86_64-apple-darwin10.4.0] | |
# ruby 1.8.6 (2010-09-02 patchlevel 420) [i686-darwin10.4.0] | |
# ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10.4.0] | |
# ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.4.0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*/*.txt | |
*.sh | |
*.gz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc "Setup pagination links for tutorial" | |
task :paginate_tutorial do | |
pages = Dir.glob File.expand_path('../Tutorial/*', __FILE__) | |
pages.each_with_index do |page, index| | |
content = File.read(page) | |
content.gsub!(/^(Previous|Next)\[link:.*\]$/, '').strip! | |
previous_page = pages[index - 1] | |
next_page = pages[index + 1] || pages[0] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# echo -e "abc\nabc" | |
# echo -e "xyz\ | |
# xyz" | |
puts `echo "abc\nabc"` | |
puts `echo "xyz\ | |
xyz"` | |
abc = "abc\nabc" | |
puts `echo "#{abc}"` |