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 / 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 / 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 / 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 / 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 / macro-reformat
Created October 1, 2013 16:30
A mutt macro to reformat e-mail message bodies. This is especially useful when you receive e-mails with very long lines of text, and you'd rather read a neatly formatted text. Simply press `Esc-f` to toggle between original message body, and reformatted with `par`.
# Add a macro on Esc-f to toggle message body filtering with par (reformat).
macro pager ,@fmton \
"<enter-command>set display_filter=/usr/bin/par<enter> \
<enter-command>macro pager \\ef ,@fmtoff 'Unformat message body'<enter> \
<exit><display-message><enter>" \
"Unformat message body"
macro pager ,@fmtoff \
@oz
oz / tmux.conf
Created December 20, 2010 15:00
My tmux.conf as of 2010/20/12
# General config:
# ---------------
setw -g utf8 on
set -g lock-after-time 1800
set-window-option -g automatic-rename off
set -g default-terminal screen
# Look & feel:
# ------------
# Panes colors
@oz
oz / octokit-wat.rb
Created May 19, 2016 15:20
Not sure if... ¬¬
client = Octokit::Client.new(...)
repo = client.repo('oz/osdb')
repo[:owner].class # => Sawyer::Resource
repo.to_h[:owner].class # => Sawyer::Resource
repo.to_hash[:owner].class # => Sawyer::Resource
repo.to_attrs[:owner].class # => Hash
onchange () {
while inotifywait --exclude .swp -e modify -r .
do
$@
done
}
@oz
oz / stock.hs
Created August 16, 2013 09:09
Playing with Yahoo's stock API in Haskell, use this little program to quickly check stock prices, or change currencies.
import Prelude
import System.Environment
import Network.HTTP
import Control.Monad
showUsage :: IO ()
showUsage = do
putStrLn "Usage: stock <options...>\n"
putStrLn " - get a quote: stock <symbol>"
putStrLn " - change money: stock <from> <to> <amount>"
@oz
oz / upgradepg.md
Created December 19, 2014 15:21
Upgading from PG 9.3 to PG 9.4 on Mac OS X, with Homebrew

Brew upgrade...

Run the usual brew update, and brew upgrade to get the latest 9.4 version of PostgreSQL.

After upgrading PG from 9.3 to 9.4 with brew, the server will not start as is. If you value your database contents, and configuration, pg_upgrade is here to migrate those.

Do not delete the old binaries at once: do not run brew cleanup, because you need 9.3 binaries to migrate.

Migration