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
for pid in `ps aux | grep '[p]ool www' | awk '{print $2}'`; do | |
head /proc/$pid/smaps | grep 'Rss' | awk '{print $2 $3}' | |
done |
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
require 'open-uri' | |
require 'json' | |
tweeter = 'JasonFalls' | |
keep_going = true | |
page = 1 | |
yes = 0 | |
no = 0 | |
while keep_going do |
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
source :rubygems | |
gem 'libusb' | |
gem 'nokogiri' |
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 = CSVBuilder.new ['column 1 name', 'column 2 name', 'column 3 name'] | |
# rowdata.each do |r| | |
# special_column = r.boolean ? 'YES' : 'NO' | |
# c.add_row [special_column, r.name, r.date] | |
# end | |
# c.export('optional_filename.csv') | |
require 'csv' | |
require 'tempfile' |
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
#!/bin/sh | |
FILENAME='check_update.sh' | |
URL='https://raw.github.com/gist/1950778' | |
if [[ -f $FILENAME ]]; then | |
echo 'Updating file in place...' | |
curl --retry 3 --progress-bar --location --time-cond $FILENAME --remote-time --output $FILENAME $URL | |
else | |
echo 'File does not exist, downloading...' |
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
source :rubygems | |
gem 'mysql2' | |
gem 'sqlite3' | |
gem 'tiny_tds' | |
gem 'sequel' | |
gem 'progressbar' |
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
<img src="foo.jpg" class="lowres" /><img src="foo2x.jpg" class="hires" /> |
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
require 'pinboard_api' | |
require 'peach' | |
require 'typhoeus' | |
hydra = Typhoeus::Hydra.new | |
PinboardApi.username = '' | |
PinboardApi.password = '' | |
pins = PinboardApi::Post.all |
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
require 'set' | |
my_data = %w(cat cat dog dog foo bar bin baz baz bin) | |
my_set = Set.new | |
my_data.each do |i| | |
if my_set.add?(i) | |
puts "#{i} is the first of its kind" | |
else |
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
class FuzzyMatch | |
class Matcher | |
require 'singleton' | |
require 'fuzzystringmatch' | |
include Singleton | |
JW = FuzzyStringMatch::JaroWinkler.create | |
def self.get_score(str1,str2) | |
JW.getDistance(str1,str2) | |
end |