Skip to content

Instantly share code, notes, and snippets.

View yannick's full-sized avatar
🏗️

Yannick Koechlin yannick

🏗️
View GitHub Profile
@yannick
yannick / mongodb_cursor_jump.py
Created March 16, 2011 21:26
mongodb cursors on indexes and jumping
#context: i want to mergejoin two generators/cursors by a key of a mongo document
#assuming an compund index af "keyA":1,"keyB":1,"keyC":1 exists.
#this is how i do it
cursor = self.collection.find( { "keyA":"foo", "keyB":"bar" }, { "keyC":1})
nextid = None
while 1:
mongo_doc = cursor.next()
require 'open-uri'
require 'nokogiri'
url = 'http://www.admin.ch/ch/d/sr/101/index.html'
doc = Nokogiri::HTML(open(url))
toc = doc.css('#spalteContentPlus')
require 'open-uri'
require 'nokogiri'
url = 'http://www.admin.ch/ch/d/sr/101/index.html'
toplink = url.gsub(/index.html$/,'')
doc = Nokogiri::HTML(open(url))
toc = doc.css('#spalteContentPlus')
#!/Volumes/data/home/yannick/.rvm/rubies/ruby-1.9.2-preview3/bin/ruby
require 'open-uri'
require 'nokogiri'
save_dir = "./html/"
url = 'http://www.admin.ch/ch/d/sr/101/index.html'
toplink = url.gsub(/index.html$/,'')
#!/Volumes/data/home/yannick/.rvm/rubies/ruby-1.9.2-preview3/bin/ruby
require 'open-uri'
require 'nokogiri'
#ideas: sinatra app with sphinx (http://sphinxsearch.com/) or elastic search backend
books = ["OR","ZGB","SchKG","URG","URV","DSG","VDSG","UWG","KG","StGB","ZPO","StPO","BV","TSchG","TSchV","MG","DR04","KMG","ZSG","ZSV","KVG","MWSTG","MWSTGV","RPG","RPV","SVG","OBG","OBV","SSV","ArG","AHVG","AHVV","BVG","UVG","UVV","EOG","EOV"]
save_dir = "./html/"
#!/usr/bin/env ruby
require 'open-uri'
require 'nokogiri'
#ideas: sinatra app with sphinx (http://sphinxsearch.com/) or elastic search backend
books = ["OR","ZGB","SchKG","URG","URV","DSG","VDSG","UWG","KG","StGB","ZPO","StPO","BV","TSchG","TSchV","MG","DR04","KMG","ZSG","ZSV","KVG","MWSTG","MWSTGV","RPG","RPV","SVG","OBG","OBV","SSV","ArG","AHVG","AHVV","BVG","UVG","UVV","EOG","EOV"]
save_dir = "./html/"
@yannick
yannick / settings.rb
Created August 8, 2012 11:39 — forked from masone/settings.rb
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__), '..')
@yannick
yannick / 0-readme.md
Created October 1, 2012 08:02 — forked from burke/0-readme.md
ruby-1.9.3-p194 cumulative performance patch.

Patched ruby 1.9.3-p194 for 30% faster rails boot

Overview

This script installs a patched version of ruby 1.9.3-p194 with boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84). It also includes the new backported GC from ruby-trunk.

Many thanks to funny-falcon for the performance patches.

@yannick
yannick / app.ls
Created November 12, 2012 16:29 — forked from pqwy/app.ls
basic livescript/express scaffold
express = require \express
app = express!
..set \views, "#__dirname/../views"
..use express.static "#__dirname/../pub"
app.get '/', (req, res) ->
res.render 'index.jade'
app.listen 3001
#require 'set'
infile = "facebook_users_to_youtube_ids_unique.gdf"
outfile = "facebook_users_edges_youtube_network.gdf.part"
users = Hash.new([])
youtube_ids = Hash.new([])
friendships = Hash.new([])
File.open(infile).each do |line|