Skip to content

Instantly share code, notes, and snippets.

View yannick's full-sized avatar
🏗️

Yannick Koechlin yannick

🏗️
View GitHub Profile
@masone
masone / settings.rb
Created August 8, 2012 11:36
Global settings object with default and environment specific values
# Loads the file config/settings/shared.yml and merges it with config/settings/ENV['SILP_CLOUD'].yml.
# If ENV['SILP_CLOUD'] is not set, local.yml will be loaded as fallback.
class Settings
include Singleton
def self.init!(silp_cloud, rails_env)
rails_root = File.join(File.dirname(__FILE__), '..')
@hanshasselberg
hanshasselberg / multiple_requests.rb
Created July 29, 2012 21:18
ethon: stream response into file.
require 'ethon'
multi = Ethon::Multi.new
[
"http://cvcl.mit.edu/hybrid/cat2.jpg",
"http://www.petscareblog.com/wp-content/uploads/2011/03/kucing.jpg",
"http://www.great-printable-calendars.com/image-files/cat-calendars-cat2.jpg"
].each_with_index{ |url, index|
easy = Ethon::Easy.new(url: url)
/**
* This module contains parsers, formatters and data types for the _http
* protocol.
*
* Headers from rfc2616 which are currently not implemented:
* $(UL
* $(LI $(LINK2 http://tools.ietf.org/html/rfc2616#section-14.8, AuthorizationHeader))
* $(LI $(LINK2 http://tools.ietf.org/html/rfc2616#section-14.9, CacheControlHeader))
* $(LI $(LINK2 http://tools.ietf.org/html/rfc2616#section-14.33, ProxyAuthenticateHeader))
* $(LI $(LINK2 http://tools.ietf.org/html/rfc2616#section-14.34, ProxyAuthorizationHeader))
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@jbgo
jbgo / git-recover-branch.md
Last active May 23, 2024 12:29
How to recover a git branch you accidentally deleted

UPDATE: A better way! (August 2015)

As pointed out by @johntyree in the comments, using git reflog is easier and more reliable. Thanks for the suggestion!

 $ git reflog
1ed7510 HEAD@{1}: checkout: moving from develop to 1ed7510
3970d09 HEAD@{2}: checkout: moving from b-fix-build to develop
1ed7510 HEAD@{3}: commit: got everything working the way I want
70b3696 HEAD@{4}: commit: upgrade rails, do some refactoring
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@peterc
peterc / dnsd.rb
Created December 2, 2011 23:47
Simple, scrappy UDP DNS server in Ruby (with protocol annotations)
# Simple, scrappy UDP DNS server in Ruby (with protocol annotations)
# By Peter Cooper
#
# MIT license
#
# * Not advised to use in your production environment! ;-)
# * Requires Ruby 1.9
# * Supports A and CNAME records
# * See http://www.ietf.org/rfc/rfc1035.txt for protocol guidance
# * All records get the same TTL
@arsduo
arsduo / gist:997914
Created May 29, 2011 16:25
Euruko demo code (Koala & Facebook)
# demo from Euruko lightning talk 2011
# links:
# * http://github.com/arsduo/koala (code/wiki documentation)
# * http://oauth.twoalex.com (easy access tokens)
# * http://developers.facebook.com/docs/coreconcepts/ (FB docs)
# the person I hang out with most
people = g.fql_query("select tagged_uids from checkin where author_uid = me()")
bestfriend = people.collect {|c| c["tagged_uids"]}.flatten.group_by {|u| u}.values.max_by(&:length).first
Koala::Facebook::GraphAPI.batch do
@bradoaks
bradoaks / hfsc-shape.sh
Created April 25, 2011 14:51 — forked from eqhmcow/hfsc-shape.sh
HFSC - linux traffic shaping's best kept secret
#!/bin/bash
# As the "bufferbloat" folks have recently re-discovered and/or more widely
# publicized, congestion avoidance algorithms (such as those found in TCP) do
# a great job of allowing network endpoints to negotiate transfer rates that
# maximize a link's bandwidth usage without unduly penalizing any particular
# stream. This allows bulk transfer streams to use the maximum available
# bandwidth without affecting the latency of non-bulk (e.g. interactive)
# streams.
$ cat tests/sparql/examples/ex11_0.rq
PREFIX a: <http://www.w3.org/2000/10/annotation-ns#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?annot
WHERE { ?annot a:annotates <http://www.w3.org/TR/rdf-sparql-query/> .
?annot dc:created ?date .
FILTER ( ?date < xsd:dateTime("2005-01-01T00:00:00Z") ) }