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
#!/bin/bash | |
export LC_ALL=en_US.UTF-8 | |
sudo apt-get --yes update | |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 | |
deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen | |
sudo apt-get --yes --fix-missing install lbzip2 pigz mongodb language-pack-en ruby-full build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config tcptrack | |
reboot | |
#While logged on | |
cd /usr/local/bin |
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
# encoding: UTF-8 | |
%w{mechanize pp mongo peach}.each { |x| require x } | |
include Mongo | |
@agent = Mechanize.new { |agent| agent.user_agent_alias = 'Mac Safari' } | |
@coll = MongoClient.new('localhost', 27017)['google']['cities'] | |
def states_in page | |
page.links.reject {|l| l.to_s.length > 2 || l.to_s.empty?} |
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
@coll = MongoClient.new('localhost', 27017)['db_name']['collection_name'] | |
already_emailed = Array.new | |
@coll.find("$and"=>[{"email"=>{"$not"=>{"$in"=>already_emailed}}},{"email"=>{"$exists"=>true}}]) |
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 'mongo' | |
require 'pp' | |
require 'json' | |
class HaystackDB | |
include Mongo | |
def initialize | |
mongo = MongoClient.new('localhost', 27017)['twitter'] | |
@whois = mongo['whois'] | |
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
require 'aws-sdk' | |
require 'eventmachine' | |
require 'tweetstream' | |
# create a table (50 read and 50 write capacity units) | |
# create primary key index using hash_key (:id) | |
#table = dynamo_db.tables.create("tweets", 10, 5, | |
# :hash_key => { :user_id => :number }, | |
# :range_key => { :created_at => :number }) |
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
git fetch --all | |
git reset --hard origin/master |
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
1. open ~/.zshrc in your favorite editor | |
2. change "export PATH=/path/to/something" to "export PATH=$PATH:/path/to/something" | |
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
<% if @user.errors.any? %> | |
<div id="error_explanation"> | |
<div class="alert alert-error"> | |
The form contains <%= pluralize(@user.errors.count, "error") %>. | |
</div> | |
<ul> | |
<% @user.errors.full_messages.each do |msg| %> | |
<li>* <%= msg %></li> | |
<% end %> | |
</ul> |
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
find . -name "*.gz" -exec gunzip {} \; -exec /bin/rm {} \; |
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
find . -type d -empty -exec rmdir {} \; |