Skip to content

Instantly share code, notes, and snippets.

@albanpeignier
albanpeignier / revelation2cvs.rb
Created October 26, 2010 09:43
Transform revelation xml export in a csv file (for PassPack, for example)
#!/usr/bin/env ruby
require 'rubygems'
require 'nokogiri'
passwords = Nokogiri::XML(IO.read(ARGV.first))
def tags_for(entry)
if entry.parent.attribute("type").to_s == "folder"
[entry.parent.xpath('name').text.downcase] + tags_for(entry.parent)
# Use multistage (require gem capistrano-ext)
require 'capistrano/ext/multistage'
set :stages, %w(sandbox unstable staging production)
set :default_stage, 'unstable'
set :application, "tryphon puppet"
set :deploy_to, "/var/lib/puppet/conf"
a
ai
aie
aient
aies
ait
as
au
aura
aurai
# rake --trace spec
(in /home/alban/share/projects/dryade/stop-area-clustering)
** Invoke spec (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
no such file to load -- i18n/backend
/var/lib/gems/1.8/gems/activesupport-2.3.8/lib/active_support/vendor/i18n-0.3.7/i18n.rb:32:in `backend'
stif_chouette=# EXPLAIN update chouette.vehiclejourneyatstop_tmp set vehiclejourneyid = v.id_new from chouette.vehiclejourney_tmp v WHERE v.id = vehiclejourneyid;
QUERY PLAN
---------------------------------------------------------------------------------------------
Hash Join (cost=59166.51..3706640.95 rows=10308224 width=1096)
Hash Cond: (vehiclejourneyatstop_tmp.vehiclejourneyid = v.id)
-> Seq Scan on vehiclejourneyatstop_tmp (cost=0.00..632584.24 rows=10308224 width=1096)
-> Hash (cost=48648.45..48648.45 rows=605045 width=16)
-> Seq Scan on vehiclejourney_tmp v (cost=0.00..48648.45 rows=605045 width=16)
# Full-screen your emacs
# requires wmctrl : apt-get install wmctrl
# found in http://www.emacswiki.org/emacs/FullScreen
(defun switch-full-screen ()
(interactive)
(shell-command (concat "wmctrl -i -r " (frame-parameter nil 'outer-window-id) " -btoggle,fullscreen")))
#!/usr/bin/env ruby
# ./script/jekyll to load jekyll extensions
require 'rubygems'
require 'jekyll'
module Jekyll
class << self
@albanpeignier
albanpeignier / gist:332818
Created March 15, 2010 13:21
caed - log messages with alsa
Mar 15 14:16:44 hyppo caed: Starting ALSA Play Device rd0:
Mar 15 14:16:44 hyppo caed: Format = 16 bit little-endian
Mar 15 14:16:44 hyppo caed: SampleRate = 44100
Mar 15 14:16:44 hyppo caed: Aggregate Channels = 2
Mar 15 14:16:44 hyppo caed: Periods = 4
Mar 15 14:16:44 hyppo caed: BufferSize = 4096 frames
Mar 15 14:16:44 hyppo caed: Device started successfully
Mar 15 14:16:44 hyppo caed: Starting ALSA Capture Device rd0:
Mar 15 14:16:44 hyppo caed: Format = 16 bit little-endian
Mar 15 14:16:44 hyppo caed: SampleRate = 44100
#!/bin/sh
# List processes which are using alsa devices
lsof +D /dev -F rt | awk '/^p/ {pid=$1} /^t/ {type=$1} /^r0x(74|e)..$/ && type == "tCHR" {print pid}' | cut -c 2- | uniq | xargs ps -fp