Skip to content

Instantly share code, notes, and snippets.

View octplane's full-sized avatar
👨‍💻
I came here for the javascript jokes and was disappointed

Pierre Baillet octplane

👨‍💻
I came here for the javascript jokes and was disappointed
View GitHub Profile
@octplane
octplane / fwissr.md
Last active August 29, 2015 13:56 — forked from aymerick/fwissr.md

This article introduces Fwissr, the configuration registry tool that we use to centralize all our configurations.

centralize your configuration files

Photo by National Library of Norway

More than five years ago, when we started to build what became fotopedia, we had a main Rails application, a Merb application for user authentication and another Merb application for photo upload. These applications were deployed by Capistrano, and our servers were configured with Puppet with some scripts to glue everything together.

As the system evolved, we slowly got rid of many of these applications and started adding other components in the application stack. Puppet was replaced by [Chef](htt

@octplane
octplane / lackr.md
Created June 2, 2014 07:59
Lackr Blog Article

Dress up your stack, add some Lackr to it

This article introduces Lackr, the core of our high speed http stack at Fotopedia.

Rest assured, lackr doesn't fork

Photo by Aurore D from Flickr

The need for Lackr emerged from the organic — but rational — way Fotonauts stack has evolved over a few years. This is the edifying tale of our long way towards modern architecture and good web performance.

use std::io::Write;
use std::fs::OpenOptions;
use std::path::{ Path};
use std::thread;
fn main() {
let dst = Path::new("./test.txt");
let mut file = OpenOptions::new().write(true).create(true).open(dst).unwrap();
file.write_all(b"create").unwrap();
@octplane
octplane / cooto.rb
Created May 4, 2010 15:56
cooto.rb
#!/usr/bin/env ruby
# Use dot separated pathspec:
# ./cooto.rb mysql.datadir
# /var/lib/mysql
require 'rubygems'
require 'chef/client'
require 'ohai'
class Chef
class Provider
class Package
class Rubygems
Chef::Log.info "Patch rubygems provider"
@@GEM_CACHE = {}
@@GEM_CACHE_TIMESTAMP = nil
25/05 16:40 ~% export rvm_trace_flag=2
25/05 16:41 ~% /Users/oct/.rvm/scripts/list
+ export rvm_trace_flag
++ echo ''
++ awk '{print $1}'
+ action=
+ [[ known = '' ]]
+ [[ default = '' ]]
+ [[ -z '' ]]
+ __rvm_list_rubies
26/05 13:30 ~/.rvm% rvm debug
ruby-1.8.7-p249:
/Users/oct/.rvm/rubies/ruby-1.8.7-p249/bin/gem: line 3: /Users/oct/.rvm/rubies/ruby-1.8.7-p249/bin/gem: Argument list too long
/Users/oct/.rvm/rubies/ruby-1.8.7-p249/bin/gem: line 3: /Users/oct/.rvm/rubies/ruby-1.8.7-p249/bin/gem: Unknown error: 0
rvm 0.1.33 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]
ruby-1.8.7-p249:
system:
uname: "Darwin Fatland.local 10.3.0 Darwin Kernel Version 10.3.0: Fri Feb 26 11:58:09 PST 2010; root:xnu-1504.3.12~1/RELEASE_I386 i386 i386 MacPro4,1 Darwin"
26/05 13:32 ~/.rvm% rvm info
ruby-1.8.7-p249:
system:
uname: "Darwin Fatland.local 10.3.0 Darwin Kernel Version 10.3.0: Fri Feb 26 11:58:09 PST 2010; root:xnu-1504.3.12~1/RELEASE_I386 i386 i386 MacPro4,1 Darwin"
shell: "bash"
version: "3.2.48(1)-release"
rvm:
type: "rvm is /Users/oct/.rvm/bin/rvm"
PATH=/Users/oct/.rvm/bin:/Users/oct/.rvm/bin:/Users/oct/.rvm/gems/ruby-1.8.7-p249/bin:/Users/oct/.rvm/gems/ruby-1.8.7-p249@global/bin:/Users/oct/.rvm/rubies/ruby-1.8.7-p249/bin:/Users/oct/bin:/opt/local/bin:/opt/local/sbin:/Users/oct/dev/sk/skprod/dist/bin:/Users/oct/dev/ec2/ec2-api-tools-1.3-36506/bin:/Users/oct/.gem/ruby/1.8/bin:/opt/local/git/libexec/git-core:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin:/Users/oct/dev/ec2/ElasticLoadBalancing-1.0.1.23/bin:/Users/kali/dev/orahome/bin
TMPDIR=/var/folders/1i/1i92nDJLH-e-pN4GIO1Gck+++TI/-Tmp-/
SHELL=/bin/zsh
HOME=/Users/oct
USER=oct
LOGNAME=oct
DISPLAY=/tmp/launch-4dBRIp/org.x:0
SSH_AUTH_SOCK=/tmp/launch-2JNjXD/Listeners
Apple_PubSub_Socket_Render=/tmp/launch-baeq8j/Render
COMMAND_MODE=unix2003
require 'thread'
module Rack
class Middleware
# This middleware will kill long running requests
class SoftTimeout
def initialize(app, options = {})
@app = app
@max_time = options[:max_time] || 50
end