Skip to content

Instantly share code, notes, and snippets.

View oc's full-sized avatar

Ole Christian Rynning oc

  • UPPERCASE
  • Oslo, Norway
View GitHub Profile
@oc
oc / gist:5657978
Created May 27, 2013 16:35
Hrrmrm..
server {
server_name www.example.com;
rewrite ^ http://example.com$request_uri? permanent;
}
upstream php-example-com-backend {
server unix:/var/run/php5-fpm.sock;
}
/etc/apt/sources.list.d/squeeze-backports.list:
file.managed:
- source: salt://backports/etc/apt/sources.list.d/squeeze-backports.list
- mode: 0644
/etc/apt/sources.list.d/salt-uppercase-backports.list:
file.managed:
- source: salt://backports/etc/apt/sources.list.d/salt-uppercase-backports.list
- mode: 0644
cmd.run:
@oc
oc / result
Created October 10, 2012 14:28
template - default variables prob...
## /etc/unicorn/blahblah.conf
RACK_ROOT="/srv/www/blahblah.muda.no"
IS_RAILS="True"
UNICORN_BIN="bundle exec bin/unicorn_rails"
UNICORN_PORT="None" # <=========== WRONG!! WTF?!
# Export RACK_ENV.
export RACK_ENV="custom"
upstream blah-muda-no-backend {
server unix:/var/run/unicorn/blah-muda-no.sock fail_timeout=0;
}
server {
server_name blah.muda.no;
client_max_body_size 10m;
root /srv/www/blah.muda.no/public;
access_log /var/log/nginx/blah.muda.no.access.log;
@oc
oc / 0master.yaml
Created September 24, 2012 21:21
Pillars
#/etc/salt/master
interface: 0.0.0.0
worker_threads: 2
file_roots:
base:
- /srv/salt/states
pillar_roots:
@oc
oc / Rakefile
Created January 13, 2012 10:19
Rakefile deployhelper example
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/lib')
require 'rubygems'
require 'bundler'
Bundler.setup
require 'thor'
require 'cucumber/rake/task'
require 'rspec/core/rake_task'
require 'label_generator/version'
require 'net/http'
require 'net/ssh'
@oc
oc / Output
Created December 8, 2011 12:49
Dec 8 13:45:39 vagrant-host puppet-agent[1838]: (/Stage[main]/Blah::Deployers/Ssh_authorized_key[oc@deploy]/ensure) created
--
Dec 8 13:45:39 vagrant-host puppet-agent[1838]: (/Stage[main]/Blah::Deployers/Ssh_authorized_key[oc@deploy]) Could not evaluate: Puppet::Util::FileType::FileTypeFlat could not write /home/admin/.ssh/authorized_keys: Permission denied - /home/admin/.ssh/authorized_keys
--
WTF? Why does it try to write /home/admin/.ssh/authorized_keys for deploy user?
@oc
oc / commandments.md
Created November 29, 2011 10:38
Ashcroft commandments
  1. I am the class being tested. Thou shalt not test any other class but me.
  2. You shall not make for yourself a mock of an API that you don't own.
  3. You shall not call a system or integration test a unit test.
  4. Your unit test suite shall not take all week to run.
  5. [father and mother]
  6. Thou shall not kill the runtime environment.
  7. [adultery]
  8. [steal]
  9. You shall not bear false witness against your neighboring tests.
  10. You shall not covet your system's files, you shall not covet your system's threads, or his sockets, or his graphics environment, or his environment variables, or anything that is part of your system.
@oc
oc / es.py
Created October 20, 2011 17:42
es.py
#!/usr/bin/env python
from flask import Flask, request
import re
import os
import math
app = Flask(__name__)
def is_prime(n):
import math
@oc
oc / statuscodes.txt
Created September 29, 2011 12:59
Status codes for Bring Tracking APIs
These are the current status codes in the tracking APIs as of 2011-09-29.
Please note: There might be more later as we are integrating several tracking systems,
so you should handle other than these in your code. For instance by warning or similar.
TERMINAL (TERMINAL)
CUSTOMS (TOLL)
DELIVERED (UTLEVERT)
ATTEMPTED_DELIVERY (FORSØKT_UTLEVERT)
DEVIATION (AVVIK)