Skip to content

Instantly share code, notes, and snippets.

View idyll's full-sized avatar
👾
pushing bits.

Mark Madsen idyll

👾
pushing bits.
View GitHub Profile
@idyll
idyll / stringstocsv.rb
Created November 19, 2011 04:39
UTF-16LE version of the sample code
require 'rubygems'
class String
def multibyte?
chars.count < bytes.count
end
end
if not ARGV[0]
abort("please pass in a .strings file to process...")
@idyll
idyll / new_relic.rb
Created November 24, 2011 08:54
NewRelic changeless needed to work with Grape on Heroku
if Rails.env.production?
require 'new_relic/agent/instrumentation/controller_instrumentation'
module NewRelic
module Agent
module Instrumentation
module API
def newrelic_request_headers
@newrelic_request.env
@idyll
idyll / newrelic.yml
Created November 24, 2011 10:41
A NewRelic config file needed to work on Heroku Cedar.
---
<%= ENV["RACK_ENV"] %>:
error_collector:
capture_source: true
enabled: true
ignore_errors: ActionController::RoutingError
apdex_t: 0.5
ssl: false
monitor_mode: true
license_key: <%= ENV["NEW_RELIC_LICENSE_KEY"] %>
@idyll
idyll / heroku.rake
Created February 17, 2012 21:08 — forked from alloy/heroku.rake
Some simple Heroku deploy rake tasks.
namespace :heroku do
namespace :deploy do
task :tag do
rev = `git rev-parse HEAD`.strip
if `git describe --contains #{rev} 2>&1`.include?('cannot describe')
version = Time.new.strftime("%Y%m%d%H%M%S")
sh "git tag -a heroku-#{version} -m 'Deploy version to Heroku: #{version}'"
sh "git push origin master"
sh "git push origin master --tags"
else
@idyll
idyll / gist:2359166
Created April 11, 2012 13:00
Install Chef Solo (w/r 1.9.3p125) for Ubuntu EC2
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential
apt-get -y install zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev
cd /tmp
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar xzvf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125/
./configure --prefix=/usr/local
make
@idyll
idyll / airbrake-deploy.sh
Created April 13, 2012 16:56
Deploy Airbrake to reset the active tickets.
bundle exec rake airbrake:deploy TO=production
@idyll
idyll / main.m
Created July 7, 2012 09:52
Objective-C Client for @tenderlove's housefire
//
// main.m
//
// Created by Mark Madsen on 2012-07-07.
// Copyright (c) 2012 AGiLE ANiMAL INC. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "AFHTTPClient.h"
#import "AFHTTPRequestOperation.h"
@idyll
idyll / status_codes.md
Created July 28, 2012 21:01
HTTP Status Codes

Status Code Definitions

Each Status-Code is described below, including a description of which method(s) it can follow and any metainformation required in the response.

Informational 1xx

This class of status code indicates a provisional response, consisting only of the Status-Line and optional headers, and is terminated by an empty line. There are no required headers for this class of status code. Since HTTP/1.0 did not define any 1xx status codes, servers MUST NOT send a 1xx response to an HTTP/1.0 client except under experimental conditions.

A client MUST be prepared to accept one or more 1xx status responses prior to a regular response, even if the client does not expect a 100 (Continue) status message. Unexpected 1xx status responses MAY be ignored by a user agent.

@idyll
idyll / pg91_to_92.md
Created December 19, 2012 19:28
Upgrading from PG 9.1 to PG 9.2 with PostgreSQL.app
## The quick-and-nasty CVE-2013-0156 Heroku inspector!
## Originally brought to you by @elliottkember with changes by @markpundsack @ Heroku
## Download and run using:
## ruby heroku-CVE-2013-0156.rb
`heroku list`.split("\n").each do |app|
app = app.strip
# Some "heroku apps" lines have === formatting for grouping. They're not apps.
next if app[0..2] == "==="