Skip to content

Instantly share code, notes, and snippets.

Avatar

Christian Nelson christiannelson

View GitHub Profile
@christiannelson
christiannelson / benchmark.md
Last active Aug 29, 2015
Comparing "hello world" in node.js under dokku versus bare metal
View benchmark.md

Dokku vs. Bare Metal

Running on an Aleutia R50 Mini-server with an Intel i3 1.7 Ghz, 16 GB and SSD.

Dokku (docker fronted by nginx)

Running 10s test @ http://node-js-sample.kuju0.carbonfive.com/
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
 Latency 6.57ms 2.04ms 26.01ms 81.91%
View Paperclip - reprocess images
Photo.all.each do |p|
begin
p.image.reprocess!
rescue Exception => e
puts "#{p.image_file_name}: #{e.class} - #{e.message}"
end
end
View mongod.conf
# /opt/local/etc/mongod.conf
# Store data someplace appropriate for a port-installed service, instead of the default: /data/db/
dbpath = /opt/local/var/db/mongodb
# Only accept local connections
bind_ip = 127.0.0.1
@christiannelson
christiannelson / mongodb
Created Jan 26, 2011
MongoDB init.d startup script
View mongodb
#! /bin/sh
### BEGIN INIT INFO
# Provides: mongodb
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: mongodb
@christiannelson
christiannelson / factories.rb
Created Apr 28, 2012
Factory Girl Build and Create
View factories.rb
# factory_girl: 3.3.0, ruby 1.9.3-p194
FactoryGirl.define do
sequence(:item_name) { %w( Milk Tea Coffee Danish Sugar Bagel Donut Toast ).sample(1) }
factory :user do |user|
name 'Christian'
email 'christian@example.com'
@christiannelson
christiannelson / install-mongo.sh
Created Aug 9, 2012
Joyent SmartMachine scripts that set things up in a saner fashion than what's prescribed by the docs
View install-mongo.sh
#!/bin/bash
# Copyright 2011 Joyent, Inc. All rights reserved.
#
# Based on http://wiki.joyent.com/download/attachments/1639170/mongodbnode.sh
# Updated to configure mongo more similarly to how it's configured on a Mongo SmartMachine.
# Tested on v1.3.3 Node.js SmartMachine and MongoDB 2.0.7
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root. Aborting..." 1>&2
@christiannelson
christiannelson / gist:4132139
Created Nov 22, 2012
Console log reproducing an issue with capybara 2.0.1 (or related)
View gist:4132139
ruby-1.9.3-p286 % rvm gemset create delme
gemset created delme => /Users/christian/.rvm/gems/ruby-1.9.3-p286@delme
ruby-1.9.3-p286 % rvm use @delme
Using /Users/christian/.rvm/gems/ruby-1.9.3-p286 with gemset delme
ruby-1.9.3-p286@delme % gem install rails
Fetching: multi_json-1.3.7.gem (100%)
Fetching: activesupport-3.2.9.gem (100%)
Fetching: builder-3.0.4.gem (100%)
@christiannelson
christiannelson / 0.sh
Created Jan 30, 2013
Raygun usage and output
View 0.sh
% raygun blogger
Creating new app Blogger in directory blogger...
Done! Next steps...
# Install updated dependencies
$ cd blogger
$ gem install bundler
$ bundle update
@christiannelson
christiannelson / new-project-setup.md
Last active Feb 15, 2016
From Nothing to Continuous Deployment in about 10 Minutes
View new-project-setup.md

These instructions walk you through using Raygun to generate a new app, pushing it to GitHub, deploying it to Heroku (two envs: production and acceptance), and setting up continuous integration and deployment using CircleCI. There's a preference for command-line operations when possible.

Prerequisties

  • Homebrew
  • Heroku toolbelt (brew install heroku-toolbelt)
  • Postgres installed (brew install postgres) and running
  • Postgres superuser called 'postgres' (createuser -s postgres)
  • PhantomJS installed (brew install phantomjs)
  • GitHub gem (gem install hub)
View keybase.md

Keybase proof

I hereby claim:

  • I am christiannelson on github.
  • I am xianpants (https://keybase.io/xianpants) on keybase.
  • I have a public key ASDLBvmc60ul0izAzkjTOx1ttbTt3MZ4Nx6jC2q49WPx-Qo

To claim this, I am signing this object: