Skip to content

Instantly share code, notes, and snippets.


Fabio Neves fzero

View GitHub Profile
fzero /
Created Aug 24, 2012
Create a RAM Drive in OS X
# Halt on all errors
set -e
# Check for size parameter and display usage if needed
if [ "$1" == "" ]; then
printf "\nRamdisk - creates a RAM disk (what else?)\n\n"
printf "Usage: ramdisk <size in MB>\n\n"
exit 1
fzero / gist:5182483
Last active Sep 13, 2016
Detaching/reattaching Mac media keys to iTunes
View gist:5182483

You've been there...

Maybe you're listening to your favourite song on Rdio, or maybe checking your Soundcloud stream. You reach for the play/pause key on your keyboard and BAM, motherfucking iTunes comes up. Don't you hate that? I do.

Luckily, there's a way to fix it. Open your terminal and type:

launchctl unload -w /System/Library/LaunchAgents/

Voilà, iTunes no longer responds to the media keys. The only downside is that now iTunes doesn't respond to the media keys at all. I couldn't care less, but if you're a crazy person who actually likes iTunes (poor you!), you can reattach the keys at any time with:

fzero /
Last active Mar 27, 2017
Bash prompt customizations for git use
# Git prompt goodness, adapted and curated from several sources.
# Just add this code to your .bash_profile/.bashrc to use it.
# It looks like this:
# ~/my/folder(my-git-branch)$
# There are variations if there are untracked files (a + will appear), uncommited changes
# (branch colour turns yellow) and if you need to pull/push (arrows will appear).
function parse_git_branch {
fzero / voice-recog.js
Last active Mar 16, 2018
Google Voice Recognition API example
View voice-recog.js
// We've followed documentation links and played with the example code a bit:
// Start here:
// If you need an audio editor, try Audacity:
// usage: node voice-recog.js soundfile.flac en-US
// The second argument is the language code (e.g. en-US, pt-BR, fr-CA...)
fzero /
Last active May 22, 2018
RBC - Lecture notes - May 22, 2018

Intro to CSS

This is the code we've worked on during May 22 class. Feel free to use it as reference!

fzero /
Last active May 24, 2018
RBC Frontend fundamentals - Flexbox
fzero /
Created May 28, 2018
RBC Frontend fundamentals - Advanced CSS
fzero / threads.rb
Last active Jul 30, 2018
Ruby skeleton for parallel iteration using threads with thread count
View threads.rb
# Thread count control
# This is the collection of data you need to process with threads
collection = []
# A nice array to store your thread objects
threads = []
fzero /
Created Dec 7, 2016
Fix Postgres encoding issue

Is you attempt to do a bin/rails db:setup or something similar and it complains like this:

PG::InvalidParameterValue: ERROR:  encoding "UTF8" does not match locale "en_US"
DETAIL:  The chosen LC_CTYPE setting requires encoding "LATIN1".

Run these commands in your Vagrant box:

fzero / flickrdl.rb
Created Dec 20, 2019
Threaded download from Flickr (not a complete script, but the main part)
View flickrdl.rb
require 'flickr_fu'
require 'httparty'
require 'pry'
DIR = "./photos"
# Prepare the downloadin'
`mkdir -p #{DIR}`