Skip to content

Instantly share code, notes, and snippets.

Adam Wiggins adamwiggins

Block or report user

Report or block adamwiggins

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View levels.json
{
"levels": [
{
"level_num": 1,
"plant_type": 0,
"color_scheme": 0,
"num_waves": 3,
"waves": [
{
"wave_num": 1,
View s3
#!/usr/bin/env ruby
require 'aws/s3'
class S3Cmd
include AWS::S3
def initialize
Base.establish_connection!(
:access_key_id => ENV['AWS_ACCESS_KEY_ID'],
View pgurl
#!/usr/bin/env ruby
usage = "pgurl <url> <command>"
url = ARGV.shift or abort usage
cmd = ARGV.shift or abort usage
require 'uri'
u = URI.parse(url)
View static_assets_middleware.rb
module Heroku
class StaticAssetsMiddleware
def initialize(app)
@app = app
end
def call(env)
# call returns an array containing [response code, header, Rack::Response]
reply = @app.call(env)
View facehugger.js
#!/usr/bin/env node
var sys = require('sys')
var net = require('net')
var child_process = require('child_process')
if (!process.env.PORT) {
sys.puts('Must specify PORT')
process.exit()
}
View udp_node_client.js
localhost';
var PORT = 9999;
var Buffer = require('buffer').Buffer,
dgram = require("dgram");
var client = dgram.createSocket();
var buf = new Buffer(4);
buf.write('PING');
View system_timeout2.rb
require 'system_timer'
require 'uri'
bad_url = 'postgres://some:user@1.2.3.4/mydb'
good_url = 'postgres://postgres@localhost/template1'
uri = URI.parse(good_url)
success = nil
View system_timeout.rb
require 'system_timer'
host = '1.2.3.4'
SystemTimer.timeout(1) do
begin
result = `psql -h #{host} -c 'select 1'`
puts "server is up"
rescue Timeout::Error
puts "server is down"
View foreman_help
foreman run [PSTYPE] [--screen,-s] [--procfile,-p FILENAME]
foreman export FORMAT(inittab,upstart) [--app,-a APP] [--output,-o FILE_OR_PATH] [--procfile,-p FILENAME] [PSTYPE=CONCURRENCY,...]
View s3put.rb
#!/usr/bin/env ruby
require 'aws/s3'
usage = "#{$0} <file> <bucket> [<access>]"
abort(usage) unless fname = ARGV.shift
abort(usage) unless bucket = ARGV.shift
access = ARGV.shift || 'private'
include AWS::S3
You can’t perform that action at this time.