Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View oz's full-sized avatar
💀
not today

Arnaud Berthomier oz

💀
not today
View GitHub Profile
@oz
oz / ambulante_ics.rb
Created May 1, 2013 21:58
A memo of how ri_cal should be used to deal with timezones. It converts http://ambulante.com.mx's schedule to ICS format too.
#!/usr/bin/env ruby
# encoding: utf-8
#
# What:
#
# A memo of how ri_cal should be used to deal with timezones. It converts
# ambulante.com.mx's schedule to ICS format too.
#
# Deps:
#
@oz
oz / vpnhost.sh
Last active December 16, 2015 06:39
This might come in handy whenever you need to add one or more hosts to a running VPN connection (on Mac OS).
#!/bin/sh
#
# vpnhost.sh - Add hosts/IP addresses to route through your VPN.
#
# - Routed hosts are not persisted between restarts of your VPN software.
# - The VPN's gateway route is hardcoded to be on the tun0 interface.
# - Use of sudo is hard-coded too.
# - Only works on OSX
VPN_IFACE=tun0
@oz
oz / clock.sh
Created April 3, 2013 03:20
The awesome world clock
#!/bin/sh
time_here=`date`
export TZ='UTC'
utc_time=`date`
export TZ='Europe/Berlin'
time_in_germany=`date`
@oz
oz / change.rb
Last active December 14, 2015 14:28
I often need to convert currencies. This can be done from various search engines, but it's faster (for me) to just type a command in a term, and get results immediately. HTH.
#!/usr/bin/env ruby
#
# change.rb -- currency conversions on the CLI
#
# Requirements:
#
# gem install nas-yahoo_stock moneta slop
#
# Getting started:
#
@oz
oz / prowl.go
Created February 27, 2013 17:29
Quick and dirty Prowl API client in Go. You'd better use prowl libs on github, this is just my backup.
package main
import (
"errors"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
@oz
oz / dbus.rb
Created February 23, 2013 03:05
Detecting screensaver state in Ruby with DBus...
#!/usr/bin/env ruby
# encoding: utf-8
require 'time'
require 'dbus'
main = DBus::Main.new
trap("INT") {
puts "Quitting..."
main.quit
@oz
oz / get-out-of-done.rb
Created February 11, 2013 18:48
A quick and dirty hack to remove yourself from Trello cards that belong to a "done" column. This is quite useful if you're using Trello as a scrum-like board, but don't want to receive notifications when someone else picks up the card. The script is originally from @shakaman, so go and thank him. Meanwhile, fork to your heart's content!
#!/usr/bin/env ruby
# encoding: UTF-8
require 'rest_client'
require 'yajl'
@api = RestClient::Resource.new('https://api.trello.com/1')
@key = 'API_KEY'
@token = 'OAUTH_TOKEN'
@login = 'YOUR_LOGIN'
@oz
oz / hello.c
Created April 10, 2012 23:07
Tofu example to speak JSON
/**
* A simple Tofu example to speak JSON.
*
* Compile:
* If you make-installed Tofu, skip the -I/-L flags. If not, export
* TOFU=/wherever/you/git-cloned/and/built/Tofu
*
* $ gcc hello.c -ltofu -ljansson -I$TOFU/include -L$TOFU/src/.libs -o hello
*
* Run:
@oz
oz / feed.js
Created March 6, 2012 02:29
Apparently a bug in feedme.js parser events
var http = require('http')
, url = require('url')
, feedme = require('feedme')
, opts = url.parse("http://wtf.cyprio.net/atom/1");
var parser = new feedme(true);
parser.on('end', function() {
var feed = parser.done();
console.log("Parsing ended... " + feed.title);
});
@oz
oz / pentadactylrc
Created April 14, 2011 23:38
A few bookmarklets I converted to Pentadactyl commands...
" Bookmark page with Pinboard.in
com -nargs=0 pin execute "open " + function(doc) { if(doc.getSelection){s=doc.getSelection();}else{s='';}; return 'https://pinboard.in/add?next=same&url='+encodeURIComponent(doc.location.href)+'&description='+encodeURIComponent(s)+'&title='+encodeURIComponent(doc.title) }(content.document)
" Read page later with Instapaper.com
com -nargs=0 readlater javascript (function(d){var z=d.createElement('scr'+'ipt'),b=d.body;try{if(!b)throw(0);d.title='(Saving...)'+d.title;z.setAttribute('src','http://www.instapaper.com/j/CJFRXrpfV0rU');b.appendChild(z);}catch(e){alert('Please wait until the page has loaded.');}void(0)})(content.document)
" Have more? :)