Skip to content

Instantly share code, notes, and snippets.

View adamburmister's full-sized avatar

Adam Burmister adamburmister

View GitHub Profile
desc "Generate and deploy assets"
task :deploy_assets, :roles => :app do
# get the previous timestamp
old_timestamp = File.read("config/deploy_timestamp").to_i rescue 0
# generate timestamp into config/deploy_timestamp
timestamp = Time.now.to_i
File.open("config/deploy_timestamp", 'w') do |f|
f.write(timestamp)
end
@adamburmister
adamburmister / hypem-crawler.rb
Created April 9, 2010 12:05
Example for crawling the music site, hypem.com, for music.
#!/usr/bin/ruby
require "rubygems"
require "hpricot"
require "open-uri"
require "builder"
require "httpclient"
require "yaml"
require "cgi"
@adamburmister
adamburmister / Google packman.js
Created May 21, 2010 15:20
Google's pacman logo
google.pacman ||
function () {
var a = true,
e = false,
g = {},
i = [1, 4, 2, 8],
l = {
0 : {
axis: 0,
increment: 0
#include <msp430x20x3.h>
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
P1DIR |= BIT6; // Set P1.6 to output direction
P1SEL |= BIT6; // P1.6 to TA0.1
CCR0 = 1000-1; // PWM Period
@adamburmister
adamburmister / quickstart.rb
Created February 4, 2011 08:38
Quickstart guide to connecting to a BackChat.io stream
require "rubygems"
require "backchat"
BackChat.connect("fred.dagg", "3b43ebca5e9703bbbeb5d0f87c87c962")
BackChat.stream("an-example-stream-name") do |msg|
puts "#{msg.sender.name} just posted a message"
end
@adamburmister
adamburmister / http streaming with backchat.io.txt
Created February 4, 2011 08:41
Curl a BackChat.io stream using your login and API key
curl -H 'Authorization: Backchat 3b43ebca5e9703bbbeb5d0f87c87c962' https://stream.backchat.io/example-stream-name
#!/bin/bash
echo "--- Type A ---"
dig $1 A | grep -v "^\;" | grep -v "^$"
echo "--- Type CNAME ---"
dig $1 CNAME | grep -v "^\;" | grep -v "^$"
echo "--- Type NS ---"
dig $1 NS | grep -v "^\;" | grep -v "^$"
echo "--- Type MX ---"
dig $1 MX | grep -v "^\;" | grep -v "^$"
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Create an EC2 instance running the Amazon Linux 32 bit AMI. The AMI is chosen based on the region in which the stack is run. This example creates an EC2 security group for the instance to give you SSH access.",
"Parameters" : {
"KeyName" : {
"Description" : "Name of and existing EC2 KeyPair to enable SSH access to the instance",
"Type" : "String"
}
# TODO: include gems in package
require 'rubygems'
require 'growl'
require 'net/http'
require 'net/https'
require 'yajl/json_gem'
# TODO: Read from ~/.backchatio_notifier file
API_KEY="YOUR_API_KEY_HERE"
STREAM_SLUG="controlbox"
require 'Date'
# precondition: assumed days_of_our_lives is defined as a range, and
# purpose? method is defined (left as an exercise for the implementor) of this class.
days_of_our_lives.reduce do |life, time|
level += 1 and eat 'cake' if Date.today.day == 10 && Date.today.month == 12
purpose?(life, time)
end