This file contains 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
#!/usr/bin/env ruby | |
def unused_images(image_path_dir, search_dirs) | |
img_fns = Dir.glob("#{image_path_dir}**/*.*") | |
search_dirs.each {|sd| img_fns.delete_if{|img_fn| `grep -r '#{File.basename(img_fn)}' #{sd}` != ""}} | |
return img_fns | |
end | |
if ARGV.size < 2 | |
puts "Usage: image_cleanup path_to_images path_to_search ..." |
This file contains 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
#!/usr/bin/env ruby | |
chapter, section, question = ARGV | |
letter = ('a'[0] + section.to_i - 1).chr | |
`open 'http://calcchat.tdlc.com/calcchat/printsolution.jsp?roomName=Calculus%208e%20#{chapter}.#{section}%20Ex%20#{question}&artName=se#{'%02d' % chapter}#{letter}01#{'%03d' % question}&chapFolder=#{'%02d' % chapter}&secFolder=#{letter}&solutionPath=http://calcchat.tdlc.com/solutionart/calc8e/'` |
This file contains 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
# format: | |
# -------------- | |
# date (mm/dd/yy) | |
# assignment | |
# assignment | |
# ... | |
# | |
# date | |
# assignment | |
# ... |
This file contains 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
> Lines beginning with `>` are comments. | |
> Comments and empty lines are ignored. | |
> | |
> Each command is defined on a single line comprised of: | |
> | |
> 1. a case-insensitive, alpha-numeric trigger followed | |
> by whitespace | |
> 2. a url followed by whitespace (if the url contains | |
> spaces they must be encoded as `%20`) | |
> 3. a short description |
This file contains 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
# C-Snake's Ruby | |
# Commonly used contest code | |
# | |
# Last updated: 3-1-2010 | |
import math | |
def fib(n): | |
'''Returns the nth fibonacci number O(n)''' | |
a, b = 0, 1 | |
i = 1 |
This file contains 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
#!/usr/bin/env ruby | |
# this line imports the libpcap ruby bindings | |
require 'rubygems' | |
require 'pcap' | |
require 'pcaplet' | |
require 'socket' | |
# thread safe... but we're counting on the fact that the sniffer won't begin again until we're at least | |
# partially requesting the song (the GET keyword has already been written by the time the network listener is listening again) |
This file contains 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
#!/usr/bin/env ruby | |
# this line imports the libpcap ruby bindings | |
require 'pcaplet' | |
# create packet sniffer on the wireless card | |
network = Pcaplet.new('-s 1500 -i en0') | |
# we only need to look at web packets | |
www_filter = Pcap::Filter.new('tcp and dst port 80', network.capture) | |
network.add_filter(www_filter) |