Skip to content

Instantly share code, notes, and snippets.

@albanpeignier
albanpeignier / octave-1.rb
Created April 23, 2012 10:55
Happy birthday
system %w{261.63 293.66 329.63 349.23 392.00 440.00 493.88 523.25}.inject(%w{ecasound}) { |chains, freq| n = chains.size-1; chains << "-a:#{n} -i playat,#{n*0.3},tone,sine,#{freq},0.3" }.join(' ')
@albanpeignier
albanpeignier / franceinter-relay.xml
Created April 12, 2012 08:56
Relay Icecast2(-kh) pour FranceInter
<relay>
<port>80</port>
<mount>/franceinter/all/franceinterhautdebit.mp3</mount>
<local-mount>/franceinter.mp3</local-mount>
<on-demand>1</on-demand>
<retry-delay>30</retry-delay>
<relay-shoutcast-metadata>1</relay-shoutcast-metadata>
<master>
@albanpeignier
albanpeignier / liquidsoap_with_filescheduler.liq
Created January 8, 2012 10:18
LiquidSoap integration for FileScheduler
#!/usr/bin/env liquidsoap
set("log.file",false)
def next_function() =
result = list.hd(get_process_lines("./bin/file-scheduler ~/Audio/file-scheduler next"))
request.create(result)
end
def forced_change()
@albanpeignier
albanpeignier / Clone
Created November 11, 2011 16:28
Recette d'une bonne Box 1/3
Confirm you want install box image (dist/disk) in /dev/sdb [y/N] :y
Formatting filesystem
* echo ',,L,*' | sudo /sbin/sfdisk -f -uS /dev/sdb
* grep -q /dev/sdb1 /proc/mounts && sudo umount /dev/sdb1 || true
* sudo mke2fs -L boot /dev/sdb1
Copy files
* sudo mount -o loop,offset=32768 dist/disk /tmp/disk-20111111-13940-14nn789
* sudo mount /dev/sdb1 /tmp/sdb1-20111111-13940-15tucum
* sudo rsync -av /tmp/disk-20111111-13940-14nn789/ /tmp/sdb1-20111111-13940-15tucum/
* sudo umount /tmp/sdb1-20111111-13940-15tucum
@albanpeignier
albanpeignier / aliases.sh
Created October 6, 2011 08:38
Bundle and shell
alias rake='bundle-exec rake'
alias cap='bundle-exec cap'
alias rspec='bundle-exec rspec'
alias rails='bundle-exec rails'
alias cucumber='bundle-exec cucumber'
alias irb='bundle-exec irb'
@albanpeignier
albanpeignier / gist:1104058
Created July 25, 2011 12:56
Trace SMTP esperanzah.dbx1 <-> mail.tryphon.eu
[esperanzah:~] swaks --from [email protected] \
--to [email protected] \
--server mail.tryphon.eu
=== Trying mail.tryphon.eu:25...
=== Connected to mail.tryphon.eu.
<- 220 mail.tryphon.eu ESMTP Postfix (Debian/GNU)
-> EHLO esperanzah.dbx1.tryphon.priv
<- 250-mail.tryphon.eu
<- 250-PIPELINING
<- 250-SIZE 10240000
@albanpeignier
albanpeignier / gist:1097913
Created July 21, 2011 18:56
puppet 2.7.2rc1 traces for Bug #8033
notice: Starting Puppet master version 2.7.2
err: Could not find class nagios::nrpe for sandbox at /home/alban/Projects/Tryphon-Puppet/manifests/templates.pp:355 on node sandbox
@albanpeignier
albanpeignier / gist:1021387
Created June 12, 2011 09:52
Rename numbered files
$ touch 01-test1 02-test2
$ rename -n 's/[0-9][0-9]-(.*)/$1/' *
01-test1 renamed as test1
02-test2 renamed as test2
$ rename 's/[0-9][0-9]-(.*)/$1/' *
$ ls
test1 test2
<p style="font-family:Verdana, Geneva, sans-serif; font-size:12px"> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="color: rgb(253, 164, 6); font-family: Verdana, Geneva, sans-serif; font-size: 18px; font-weight: bold;">Titre</span></span></p>
@albanpeignier
albanpeignier / language_steps.rb
Created November 23, 2010 15:21
Step to change accepted languages with Cucumber and Capybara
class Capybara::Driver::RackTest
def headers(key = nil, value = nil)
if key.nil?
@headers ||= {}
elsif value.nil?
headers[key]
else
headers[key] = value
end
end