Skip to content

Instantly share code, notes, and snippets.

@bvishny
bvishny / RepinlyScraper.rb
Created May 18, 2013 05:34
A simple scraper to get the top pinners from Repinly. NOTE: As of the posting of this script (5/18/13), Repinly's Terms of Use (http://www.repinly.com/terms.aspx) does NOT prohibit the use of robots to retrieve information. If this changes, please DO NOT USE THIS SCRIPT.
require 'rubygems'
require 'mechanize'
require 'json'
class RepinlyScraper
attr_accessor :config
attr_accessor :page
attr_accessor :data # a hashmap associating Pinterest User names to email addresses and locations (if on their profile). Transmit this as you would like.
# FORCE UTF-8 ENCODING
@bvishny
bvishny / sample_test_config.yml
Last active December 21, 2015 03:39
Below is a sample test config in YAML. aus1 is the replset name and the below keys are the host addresses. Each host has an array of settings and sequence numbers at which to apply certain settings - which remain until they are overwritten. Every time a message is sent to all the collectors to get data, the sequence number is incremented. Below …
---
aus1:
myhost:27017:
- seq: 0
sync: myhost:27018
state: 2
wait: 200
optime: -2000
- seq: 5
sync: myhost:27020
@bvishny
bvishny / swap.rb
Last active December 22, 2015 18:39
Swap redone
# Validates the input arrays
# Tests that a1 and a2 are of equal length
# And that the numbers in a2 all are valid indices
def validate_inputs(a1, a2)
raise ArgumentError, "a1 and a2 must be of equal sizes!" if a1.size != a2.size
a2.each_with_index { |num, i|
raise ArgumentError, "Element at position #{i} of a2 is an invalid index!" if num < 0 or num >= a1.size
}
end
//See README.md
var express = require('express');
var anyDB = require('any-db');
//Make sure zipcodes.db exists before you do this!
var conn = anyDB.createConnection('sqlite3://zipcodes.db');
var app = express();
//Your server implementation goes here!

Keybase proof

I hereby claim:

  • I am bvishny on github.
  • I am elevator (https://keybase.io/elevator) on keybase.
  • I have a public key whose fingerprint is D32F 42A4 6817 EFD4 2654 AF69 6473 CE93 2F84 84A9

To claim this, I am signing this object: