Skip to content

Instantly share code, notes, and snippets.

Avatar

Fabio Neves fzero

View GitHub Profile
@fzero
fzero / masstagger.sh
Created Jul 15, 2011
A quick automatic tagger for MP3 (uses eyeD3 - http://eyed3.nicfit.net)
View masstagger.sh
#!/bin/bash
# This expects files ordered like:
# Artist/Album/01 Track Title.mp3
#
# You should provide the dir containing the Artist dirs at the command line.
START="$1"
if [ "$START" == "" ]; then
@fzero
fzero / wp-upgrade.sh
Created Jul 15, 2011
Update several self-hosted Wordpress blogs at once on Dreamhost
View wp-upgrade.sh
#!/bin/bash
cd $HOME
# Add here every domain/folder where you have Wordpress installed.
# Dreamhost normally puts all domains on $HOME, so this is what I do.
DOMAINS="mydomain1.com mydomain2.com mydomain3.com"
# Add here any dirs, file patterns etc. that you don't want to backup before upgrading.
# These are MY settings; tweak according to your needs.
@fzero
fzero / gist:1111866
Created Jul 28, 2011
Vim: Remove trailing blanks from all lines in a file
View gist:1111866
" Removes trailing spaces
function TrimWhiteSpace()
%s/\s*$//
''
:endfunction
" Associates it with F2 key
map! <F2> :call TrimWhiteSpace()<CR>
@fzero
fzero / vimrc.after.vim
Last active Sep 26, 2015
My VIM customizations on top of Janus (https://github.com/carlhuda/janus) - ~/.vimrc.after
View vimrc.after.vim
" Customizations
if has("gui_macvim")
" Get rid of toolbar buttons
set go=egmrLi
let macvim_hig_shift_movement=1
endif
" Sets default colorscheme to Solarized and configures 256-color terminal.
set t_Co=256
let g:solarized_termcolors=256
@fzero
fzero / 1 bashrc.sh
Last active Mar 27, 2017
My bash customizations with git-aware prompt and some aliases.
View 1 bashrc.sh
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# Prompt goodness
#
# This is for my local machine, so I don't display the host to save space (I do on remote servers).
# It looks like this:
#
# ~/Code/some_dir(my-git-branch)$
#
@fzero
fzero / ramdisk.sh
Created Aug 24, 2012
Create a RAM Drive in OS X
View ramdisk.sh
#!/bin/bash
# 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
fzero / xlr8r.rb
Created Oct 31, 2012
Downloads the latest MP3 from XLR8R
View xlr8r.rb
#!/usr/bin/env ruby
# Dependencies: wget and the following gems:
require 'rubygems'
require 'feedzirra'
require 'httparty'
feed_url = 'http://feeds.xlr8r.com/xlr8rmp3s'
feed = Feedzirra::Feed.fetch_and_parse(feed_url)
@fzero
fzero / 1 tmux.conf
Last active Jun 3, 2021
Some tmux configurations, scripts and aliases I use.
View 1 tmux.conf
# I prefer ctrl-a - helps when dealing with machines that only have Screen
unbind C-b
set -g prefix C-a
# Making windows purrty
set-window-option -g status-bg cyan
set-window-option -g status-fg black
set-window-option -g window-status-current-bg black
set-window-option -g window-status-current-fg white
@fzero
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/com.apple.rcd.plist

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
fzero / dataoauth.md
Last active Dec 17, 2015
Example OAuth callbacks as received by the omniauth gem for Twitter, Tumblr and Instagram.
View dataoauth.md