Skip to content

Instantly share code, notes, and snippets.

View vinc's full-sized avatar

Vincent Ollivier vinc

View GitHub Profile
@vinc
vinc / goodreads.rb
Last active December 25, 2019 20:08
require "csv"
require "rainbow/refinement"
using Rainbow
headers = ["Book Id", "ISBN", "Title", "Author", "Date Read"]
CSV.open("output.csv", "wb") do |csv|
csv << headers
CSV.foreach(ARGV.shift, headers: true) do |row|
puts format("%s %s (%d/5) %s", row["Date Added"].cyan, row["Title"], row["My Rating"], row["Exclusive Shelf"].yellow)
$ rails server
/home/v/.rbenv/versions/2.5.0/lib/ruby/2.5.0/set.rb:625: warning: already initialized constant Set::InspectKey
/home/v/.dotfiles/_rbenv/versions/2.5.0/lib/ruby/2.5.0/set.rb:625: warning: previous definition of InspectKey was here
/home/v/.rbenv/versions/2.5.0/lib/ruby/2.5.0/pathname.rb:20: warning: already initialized constant Pathname::TO_PATH
/home/v/.dotfiles/_rbenv/versions/2.5.0/lib/ruby/2.5.0/pathname.rb:20: warning: previous definition of TO_PATH was here
/home/v/.rbenv/versions/2.5.0/lib/ruby/2.5.0/pathname.rb:22: warning: already initialized constant Pathname::SAME_PATHS
/home/v/.dotfiles/_rbenv/versions/2.5.0/lib/ruby/2.5.0/pathname.rb:22: warning: previous definition of SAME_PATHS was here
/home/v/.rbenv/versions/2.5.0/lib/ruby/2.5.0/pathname.rb:34: warning: already initialized constant Pathname::SEPARATOR_LIST
/home/v/.dotfiles/_rbenv/versions/2.5.0/lib/ruby/2.5.0/pathname.rb:34: warning: previous definition of SEPARATOR_LIST was here
/home/v/.rbenv/versions/2.5.0/lib/ruby/2.5.0/pat
RUBY_BUILD_REPO="https://github.com/sstephenson/ruby-build.git"
RUBY_BUILD_PATH="$(rbenv root)/plugins/ruby-build"
git clone $RUBY_BUILD_REPO $RUBY_BUILD_PATH
rbenv install 2.1.5
rbenv global 2.1.5
rbenv rehash
gem install bundler pry rails
rbenv rehash
jamos_tables = [
%w(g gg n d dd r m b bb s ss - j jj c k t p h),
%w(a ae ya yae eo e yeo ye o wa wae oe yo u weo we wi yu eu yi i),
%w(- g gg gs n nj nh d l lg lm lb ls lt lp lh m b bs s ss ng j c k t p h)
]
transcoded_text = ARGF.read.split.map do |word|
syllables = word.scan(/[ptksmnljw]?[aeiou][n]?/)
unicodes = syllables.map do |syllable|
@vinc
vinc / randpiano.py
Created June 29, 2014 16:04
Random MIDI piano playing in Python
import time
import random
import fluidsynth
import futures
fs = fluidsynth.Synth()
fs.start(driver='alsa')
sfid = fs.sfload('piano.sf2')
fs.program_select(0, sfid, 0, 0)
@vinc
vinc / piano.sh
Created June 29, 2014 16:02
MIDI USB keyboard to USB DAC via jack and fluidsynth
# cat /proc/asound/cards
# aconnect -i
# aconnect -o
rate="96000"
soundfont="piano.sf2"
killall fluidsynth
jack_control stop
require 'date'
require 'json'
require 'fitgem'
consumer_key = 'xxx'
consumer_secret = 'xxx'
oauth_file = 'oauth.json'
if File.exist?(oauth_file)
oauth = JSON.parse(File.read(oauth_file), symbolize_names: true)
<!DOCTYPE html>
<html>
<head>
<title>Accelerocolor</title>
<script type="text/javascript">
window.onload = function() {
var rgb = [255, 255, 255];
var orientation = [0.0, 0.0, 0.0];
var update = function(i, x) {
@vinc
vinc / readlater.rb
Created February 19, 2012 17:49
CLI for sending URLs to Instapaper
require 'uri'
require 'net/http'
require 'yaml'
require 'highline/import'
abort 'Usage: readlater <url>' if ARGV.length == 0
# Build Request(s)
api = 'https://www.instapaper.com/api'
uri = URI("#{api}/add")
@vinc
vinc / call_facebook_robot.py
Created July 13, 2011 07:33
Script calling Facebook's robot to visit URLs from a RSS feed.
#!/usr/bin/env python
import feedparser
import os
import pickle
import sys
import time
import urllib
facebook_lint = 'https://developers.facebook.com/tools/lint?url='