Skip to content

Instantly share code, notes, and snippets.

View sylvainsf's full-sized avatar

Sylvain Niles sylvainsf

  • Microsoft Azure
  • Seattle
View GitHub Profile
@sylvainsf
sylvainsf / google_music_track_list.js
Created May 2, 2018 23:19
Get a track list from a google music playlist
// Setup
var tracklistObj = {},
currentPlaylist,
checkIntervalTime = 100,
lastTime;
// Process the visible tracks
function getVisibleTracks() {
@sylvainsf
sylvainsf / debian7.0-apt.erb
Created June 20, 2013 22:12
A chef template for bootstrapping Debian 7.0
bash -c '
<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
exists() {
if command -v $1 &>/dev/null
then
return 0
else
return 1
fi
{
"name": "base-test11",
"chef_environment": "_default",
"normal": {
"tags": [
],
"ec2opts": {
"lvm": {
cat > ./wav2mp3.sh <<DELIM
#!/bin/sh
# name of this script: wav2mp3.sh
# wav to mp3
for i in *.wav; do
if [ -e "$i" ]; then
file=`basename "$i" .wav`
lame -h -b 192 "$i" "$file.mp3"
fi
require "spec_helper"
feature 'as a business' do
let(:business) { FactoryGirl.create(:business) }
let(:j1) { FactoryGirl.create(:job) }
let(:fj1) { FactoryGirl.create(:finished_job) }
let(:fjnr) { FactoryGirl.create(:finished_job, :state => NEEDS_REVIEW) }
before(:all) do
require 'bundler'
require 'bundler/setup'
require 'capistrano/ext/multistage'
require 'bundler/capistrano'
require 'rvm/capistrano'
require 'whenever/capistrano'
require './config/boot'
require 'airbrake/capistrano'
require 'capistrano-resque'
deploy@nancy:~/cap/current$ rvm list
rvm rubies
=* ruby-1.9.2-p320 [ x86_64 ]
# => - current
# =* - current && default
# * - default
@sylvainsf
sylvainsf / gist:1454164
Created December 10, 2011 01:17
no_rvm
set :default_shell do
case no_rvm
when false
shell = File.join(rvm_bin_path, "rvm-shell")
ruby = rvm_ruby_string.to_s.strip
shell = "rvm_path=#{rvm_path} #{shell} '#{ruby}'" unless ruby.empty?
when true
shell = "/bin/bash"
end
shell
@sylvainsf
sylvainsf / somefile.erl
Created August 8, 2011 22:46
erlang map reduce checking json contents
get_stuff(Object, _KeyData, Args) ->
FVal = mochijson:binary_decode(riak_object:get_value(Object)),
FKey = riak_object:key(Object),
{struct, FValIn} = FVal,
FLabel = proplists:get_value(<<"some_label">>, FValIn, 0),
% Lets assume our arg is <<10>> and <<"some_label">> = 9
case FLabel < Args of
true ->
% Return [[Riak_Key, Value]]
[[FKey, mochijson:binary_decode(riak_object:get_value(Object))]];