Skip to content

Instantly share code, notes, and snippets.

View cappert's full-sized avatar

Camille Appert cappert

View GitHub Profile
# http://www.pauldix.net/2008/08/serializing-dat.html
require 'benchmark'
require 'rubygems'
require 'json'
require 'yaml'
include Benchmark
benchmark_iterations = 1
large_single_dimension_array = [42, 123.123] * 5000
@cappert
cappert / Jabber-SH
Created December 17, 2009 15:46 — forked from pcreux/Jabber-SH
#!/usr/bin/env ruby
# Jabber-SH — SH console via XMPP/Jabber (GTalk)
#
# Jabber-SH allows you to administrate a remote computer via a command line
# through a Jabber client. It’s like SSH via GoogleTalk! :)
# This is just a hack but it might be usefull sometime to run basic commands
# on a machine that is not accessible via ssh.
#
# Philippe Creux. pcreux/AT/gmail/DOT/com
// Attempt to make a drop-and-forget bunch of scripts that mimick some missing html5 goodies automatically
// Example:
// $(document).ready(function() {
// ProvideHtml5.autofocus()
// ProvideHtml5.datepicker()
// ProvideHtml5.forcenumber()
// })
var ProvideHtml5 = {
autofocus = function() {
# from http://media.railscasts.com/videos/096_git_on_rails.mov
# empty directories
# $ touch tmp/.gitignore log/.gitignore vendor/.gitignore
#.gitignore
.DS_Store
log/*.log
tmp/**/*
config/database.yml
#!/usr/bin/env ruby
hache = {"A" => 3107227, "B" => 3814675 , "C" => 6639564 , "D" => 741901 , "E" => 7579381 , "F" => 4428177 , "G" => 3842022 }
sum = {}
hache.each { |name, size|
copy = hache.dup
copy.delete(name)
sum[name] =copy.values.inject {|x, y| x += y}
}
@cappert
cappert / git-dot
Created February 15, 2010 01:34 — forked from madx/git-dot
#!/usr/bin/env ruby
class Grapher
class << self
Props = {
:branch => '[shape=box,style=filled,fillcolor="#ccffcc",color="#003300"]',
:commit => '[style=filled,fillcolor="#ffffcc",color="#663333"]',
:ref => '',
:relation => '[dir=back,color="#545443"]',
module Feedzirra
module Parser
class FlickrEntry
include SAXMachine
include FeedEntryUtilities
element :guid, :as => :id
element :title
#!/usr/bin/env ruby
## WP2TUMBLR: WordPress 2 Tumblr Importing tool
##
## Usage: wp2tumblr [OPTION] WORDPRESS_XML_FILE
##
## Import the WORDPRESS_XML_FILE to a Tumblr blog.
## Provide `--group` option to publish to a group.
## This could take a long time...
##
## To install, download the script and chmod to 755.
@cappert
cappert / Gemfile
Created May 21, 2010 19:22 — forked from d--j/Gemfile
# include at least one source and the rails gem
source :gemcutter
gem 'rails', '~> 2.3.5', :require => nil
group :development do
# bundler requires these gems in development
gem 'rails-footnotes'
end
group :test do
<?xml version="1.0" encoding="UTF-8" ?>
<schema name="basecamp" version="1.3">
<types>
<!-- indexed/stored verbatim -->
<fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true" omitTermFreqAndPositions="true"/>
<!-- "true" or "false" -->
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true" omitTermFreqAndPositions="true"/>
<!-- binary data, base64 -->