Skip to content

Instantly share code, notes, and snippets.

View gwik's full-sized avatar

Antonin Amand gwik

View GitHub Profile
@gwik
gwik / ogg.go
Last active August 29, 2015 14:06
ogg decoder for sniffing content type.
package main
import (
"bytes"
"encoding/binary"
"errors"
"fmt"
"io"
"os"
"strings"
@gwik
gwik / gist:8563158
Created January 22, 2014 17:31
Spec demonstrating broken weakref as hash key in rubymotion.
describe "WeakRef hash support" do
before do
@k = "key"
@w = WeakRef.new(@k)
@h = {@w => :value}
end
it "can be accessed with the original object" do
@h[@k].should == :value
@gwik
gwik / gist:6298001
Last active March 16, 2016 22:53
Database setup and seeds for Rails, RSpec, Capybara, DatabaseCleaner and friends
# Database setup and seeds loading
# See the block post : http://sigkill.tumblr.com/post/58933579738/test-database-setup-and-seeds-with-rails-rspec
module Seeder
@@__cache__ = {}
def self.load_seed(filename, prefix='app')
filename = Rails.root + "db/seeds/#{prefix}/#{filename}.seeds.rb"
seed_mod = @@__cache__[filename] ||= begin
mod = Module.new
#!/usr/bin/env bash
set -e
cd ~/.rbenv/src
curl -LO 'ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p448.tar.gz'
tar xvzf ruby-1.9.3-p448.tar.gz && cd ruby-1.9.3-p448/
./configure --prefix="$HOME/.rbenv/versions/1.9.3-p448" --enable-shared --with-opt-dir=/opt/local
make
make install
@gwik
gwik / gist:5901360
Last active December 19, 2015 04:59 — forked from mitnick78/gist:5901312
sudo port install tk tcl readline apple-gcc42 openssl
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
cd ~/.rbenv && mkdir src && cd src
curl -LO 'ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz'
tar xvzf ruby-2.0.0-p247.tar.gz
@gwik
gwik / geventmongo.py
Created August 31, 2011 18:17
PyMongo >=2.0 pool for gevent
# Copyright 2011 10gen
#
# Modified by Antonin Amand <antonin.amand@gmail.com> to work with gevent.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@gwik
gwik / zerologger.py
Created July 10, 2011 18:43
Python logger ZeroMQ, Gevent, CouchDB
# encoding: utf-8
"""
A python logging Handler that use ZeroMQ (ØMQ).
+------+ +------+ +-------+
| app1 | | app2 | | app X |
+------+ +------+ +-------+
| PUSH | PUSH | PUSH
| | |
@gwik
gwik / mysql-ruby-2.6-patch-ruby1.9.1rc1.patch
Created January 3, 2009 17:55
Patch for mysql-ruby-2.6 to work with ruby 1.9.1rc1
commit 7df6d1b37b57476771ee7ae764e3236eb0d22e8f
Author: Antonin Amand <antonin.amand@gmail.com>
Date: Sat Jan 3 18:42:57 2009 +0100
fixes for 1.9
diff --git a/extconf.rb b/extconf.rb
index bc00612..f502d4f 100644
--- a/extconf.rb
+++ b/extconf.rb