Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Daniel Huckstep darkhelmet

🏠
Working from home
Block or report user

Report or block darkhelmet

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
@darkhelmet
darkhelmet / wale_postgres_recovery.md
Created Feb 15, 2014 — forked from elithrar/wale_postgres_recovery.md
WAL-E + Postgres 9.x (single server + DB) Setup and Recovery
View wale_postgres_recovery.md

A quick "how to" on what you need to do to both setup AND recover a single-server PostgreSQL database using WAL-E

  • WAL-E: https://github.com/wal-e/wal-e
  • Assuming Ubuntu 12.04 LTS ("Precise")
  • We'll be using S3. Make sure you have an IAM in a group with GetObject, ListBucket and PutObject on the bucket you want to use (and that it's not public).

Setup:

  1. These packages:
@darkhelmet
darkhelmet / docker-ruby-fpm.sh
Created Mar 4, 2014 — forked from dysinger/docker-ruby-fpm.sh
Using docker to build deb of ruby so you don't need to use rvm or something on the server
View docker-ruby-fpm.sh
cat > Dockerfile <<\EOF
FROM ubuntu:12.04
RUN apt-get update
RUN apt-get install -y ruby1.9.3 build-essential \
libc6-dev libffi-dev libgdbm-dev libncurses5-dev \
libreadline-dev libssl-dev libyaml-dev zlib1g-dev
RUN gem install fpm --bindir=/usr/bin --no-rdoc --no-ri
RUN apt-get install -y curl
RUN curl ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p484.tar.gz|tar oxzC /tmp
WORKDIR /tmp/ruby-1.9.3-p484
@darkhelmet
darkhelmet / gist:9987548
Last active Aug 29, 2015
Uploading a specific pair of files to rails 4.0.4/rbx 2.2.6/nginx 1.5.12/passenger enterprise 4.0.40 fails
View gist:9987548
App 11159 stderr: [ 2014-04-04 22:31:47.7216 11313/0x2320c(Worker 4) utils.rb:52 ]: *** Exception NoMethodError in Rack application object (undefined method `-' on nil:NilClass.) (process 11313, thread 0x2320c(Worker 4)):
App 11159 stderr: from kernel/delta/kernel.rb:78:in `- (method_missing)'
App 11159 stderr: from kernel/common/string.rb:1997:in `[]='
App 11159 stderr: from kernel/common/string.rb:1332:in `slice!'
App 11159 stderr: from /home/deploy/cogs/shared/bundle/rbx/2.1/gems/rack-1.5.2/lib/rack/multipart/parser.rb:113:in `get_current_head_and_filename_and_content_type_and_name_and_body'
App 11159 stderr: from /home/deploy/cogs/shared/bundle/rbx/2.1/gems/rack-1.5.2/lib/rack/multipart/parser.rb:19:in `parse'
App 11159 stderr: from kernel/common/kernel.rb:460:in `loop'
App 11159 stderr: from /home/deploy/cogs/shared/bundle/rbx/2.1/gems/rack-1.5.2/lib/rack/multipart/parser.rb:17:in `parse'
App 11159 stderr: from /home/deploy/cogs/shared/bundle/rbx/2.1/gems/rack-1.5.2/lib/rack/multipart.rb:25:in `p
View gist:11390354
~/dev/go/src/github.com/darkhelmet/enumerable (master?) » go test -i
can't load package: package github.com/stretchr/testify/assert: cannot find package "github.com/stretchr/testify/assert" in any of:
/Users/darkhelmet/local/go/src/pkg/github.com/stretchr/testify/assert (from $GOROOT)
/Users/darkhelmet/dev/go/src/github.com/stretchr/testify/assert (from $GOPATH)
View active_admin.rb
# if you want to monkey patch every controller, put this in initializers/active_admin.rb
ActiveAdmin::ResourceController.class_eval do
include ActiveAdmin::CSVStream
end
View chromium-install.sh
#!/usr/bin/env bash
# install some packages
sudo aptitude install -y subversion pkg-config python perl g++ g++-multilib bison flex gperf libnss3-dev libgtk2.0-dev libnspr4-0d libasound2-dev libnspr4-dev msttcorefonts libgconf2-dev libcairo2-dev libdbus-1-dev wdiff
# get and setup the depot tools
svn co http://src.chromium.org/svn/trunk/tools/depot_tools
export PATH=`pwd`/depot_tools:$PATH
mkdir chromium
pushd chromium
View lark_template.rb
# download and git methods swiped from http://github.com/Sutto/rails-template/blob/07b044072f3fb0b40aea27b713ca61515250f5ec/rails_template.rb
require 'open-uri'
def download(from, to = from.split("/").last)
#run "curl -s -L #{from} > #{to}"
file to, open(from).read
rescue
puts "Can't get #{from} - Internet down?"
exit!
View controllers.rb
class WidgetController < ApplicationController
include RespondGlue
def index
@widgets = some_magic
respond_glue(:html) { render(:template => 'widgets/index') }
end
def show
@widget = get_widget
View jquery-remote-inline.js
$.fn.setupRemoteInline = function() {
return this.each(function() {
$(this).click(function() {
var link = $(this);
link.unbind('click');
link.html('Loading...');
$.ajax({
url:this.href,
type:'GET',
success:function(data) {
View output.txt
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ./configure --prefix=/home/darkhelmet/local/llvm-gcc --enable-languages=c,c++ --program-prefix=llvm- --enable-llvm=/home/darkhelmet/local/llvm
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5636) (LLVM build)
You can’t perform that action at this time.