Skip to content

Instantly share code, notes, and snippets.

require 'nokogiri'
require 'open-uri'
r = open('http://en.wikipedia.org/wiki/List_of_The_Price_Is_Right_pricing_games').read
doc = Nokogiri::HTML(r)
name = doc.css('span.mw-headline').map(&:text).select{|name| name.size > 1}.sample
@abevoelker
abevoelker / foo_spider.py
Last active August 29, 2015 13:59
scrapy Sidekiq pipeline (resque support shouldn't be too hard)
# project_name/spiders/foo_spider.py
from scrapy.contrib.spiders import CrawlSpider
class FooSpider(CrawlSpider):
post_process = dict(
klass = "Foo::Worker",
# queue = "default",
# retry = True,
)
@abevoelker
abevoelker / README.md
Last active August 29, 2015 14:08
The docker-gc shell function I use to keep Docker from filling up my hard disk
@abevoelker
abevoelker / haproxy.cfg
Last active August 29, 2015 14:11 — forked from GABeech/haproxy.cfg
# This is an example of the Stack Exchange Tier 1 HAProxy config
# The only things that have been changed from what we are running are:
# 1. User names have been removed
# 2. All Passwords have been remove
# 3. IPs have been changed to use the example/documentation ranges
# 4. Rate limit numbers have been changed to randome numbers, don't read into them
userlist stats-auth
group admin users $admin_user
user $admin_user insecure-password $some_password

How annoying is it that Rails doesn't do what you tell it, but tries to be smart? Trying to use custom DB logic in a Rails migration:

create_table :foos do |t|
  t.timestamp :inserted_time, null: false, default: 'now()'
end

Results in this:

### Keybase proof
I hereby claim:
* I am abevoelker on github.
* I am abevoelker (https://keybase.io/abevoelker) on keybase.
* I have a public key whose fingerprint is 7C75 A5F5 E608 E133 4314 7A24 65A8 0811 BC6A 8D92
To claim this, I am signing this object:
scala> val scores = Map("a" -> 100, "b" -> 101)
scores: scala.collection.immutable.Map[String,Int] = Map(a -> 100, b -> 101)
scala> scores.filter { case (_, i) => i > 100 }
java.lang.AssertionError: assertion failed: List(value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp, value _2$mcI$sp)
at scala.reflect.internal.Symbols$Symbol.suchThat(Symbols.scala:1916)
at scala.tools.nsc.transform.SpecializeTypes$$anon$2.matchingSymbolInPrefix$1(SpecializeTypes.scala:1460)
at scala.t
data Tree = Empty
| Leaf Int
| Node Tree Tree
@abevoelker
abevoelker / ebaydoorbuster.php
Created June 12, 2010 13:23
eBay Doorbuster 2008 script; eBay automated purchase section is still useful
<?php
/* Original code written by Abe Voelker, copyright 2008 */
/* Last updated: 12/07/08 3:45am CST - added IP Ban workaround - set $ALTERNATE_INTERFACE to an alternate IP/hostname/adapter (but only if your server has access to it!); also cleaned up some of the code */
/* NOTE - If you can't seem to get logged in to eBay, remove any special characters from your password OR userid such as )(*&^%$#@!./,";?><}{][ */
/* This code is released for educational purposes only, as a proof of concept. Please do not execute it against any eBay
server as it probably violates eBay's ToS. In addition, some of the code I have used are snippets from other sources; I
@abevoelker
abevoelker / getRcodeParams.pl
Created September 15, 2010 17:48
Get Progress OpenEdge ABL main block parameters from compiled object (.r) code (tested on Unix 10.1C compiles)
#!/usr/bin/perl
#-------------------------------------------------------------------------------
# File: getRcodeParams.pl
# Purpose: Decodes the main block parameters of compiled OpenEdge ABL r-code.
# Arguments: [0] File system location of an r-code file to parse
# Returns: List of parameters (newline-separated) from the main execution
# block. The parameters are in the form:
# [input/output type] [variable name] [datatype]
# Author(s): Abe Voelker
# Created: 2010-09-14