Skip to content

Instantly share code, notes, and snippets.

function ziptotgz(){
TMPDIR=`mktemp -dt ziptotgz` || exit 1
unzip -qd $TMPDIR $1
pushd $TMPDIR > /dev/null
tar -czf ${1/%.zip/.tar.gz} ./*
popd > /dev/null
rm -rf $TMPDIR
@shello
shello / MBNet Bookmarket [pt]
Created December 8, 2010 19:32
Bookmarket para o gerador de cartões do mbnet.pt.
javascript:(function(){window.open("https://www.mbnet.pt/mbnetAut.html","MBNet","toolbar=no,menubar=no,resizable=yes,width=299,height=299");})();
filipe@macfilipe ~% sudo brew install -v weechat
==> Downloading http://www.weechat.org/files/src/weechat-0.3.5.tar.bz2
File already downloaded and cached to /Library/Caches/Homebrew
/usr/bin/tar xf /Library/Caches/Homebrew/weechat-0.3.5.tar.bz2
==> cmake -DPREFIX=/usr/local/Cellar/weechat/0.3.5 -DENABLE_RUBY=OFF -DENABLE_PERL=OFF -DCMAKE_INSTALL_PREFIX='/usr/local/Cellar/weechat/0.3.5' -DCMAKE_BUILD_TYPE=None -Wno-dev .
cmake -DPREFIX=/usr/local/Cellar/weechat/0.3.5 -DENABLE_RUBY=OFF -DENABLE_PERL=OFF -DCMAKE_INSTALL_PREFIX='/usr/local/Cellar/weechat/0.3.5' -DCMAKE_BUILD_TYPE=None -Wno-dev .
-- The C compiler identification is GNU
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
@shello
shello / du_sort.py
Created June 7, 2011 22:16 — forked from meqif/du_sort.py
Short script for sorting 'du' output correctly. meqif did it in both Ruby and Python as practice; I perfected the python version.
#!/usr/bin/env python
import sys
UNIT_FACTORS = {'B': 0, 'K': 1, 'M': 2, 'G': 3, 'T': 4, 'P': 5}
def bytes_multiplier(unit):
if UNIT_FACTORS.has_key(unit):
return 1024 ** UNIT_FACTORS[unit]
else:
@shello
shello / gist:1397691
Created November 27, 2011 15:24
virtualenvwrapper loader.
VIRTUALENVWRAPPER_PATH="/usr/local/Cellar/python/2.7.1/bin/virtualenvwrapper.sh"
function virtualenvwrapper () {
if [ ! -n "${VIRTUALENVWRAPPER_SET}" ]; then
source ${VIRTUALENVWRAPPER_PATH}
VIRTUALENVWRAPPER_SET=true
echo "virtualenvwrapper loaded."
fi
}
@shello
shello / .htaccess
Created January 23, 2012 01:39
Rewrites for redirecting to your online bookmarking service of choice (change your username)
RewriteEngine On
# Shorturl for online bookmark tags: Pinboard
RewriteRule ^$ https://pinboard.in/u:shello/ [L,R=301]
RewriteRule ^(.*)$ https://pinboard.in/u:shello/t:$1/ [L,R=301]
# Shorturl for online bookmark tags: Delicious
# RewriteRule ^(.*)$ http://delicious.com/ptshello/$1 [R=301]
@shello
shello / gist:1670681
Created January 24, 2012 15:26
Write to a 'files.shasum' file the SHA Checksum of the regular files under the current directory (recursively), sorted alphabetically within each directory, while avoiding the output file.
OUTFILE='files.shasum' find -s . -type f -not -samefile $OUTFILE -exec shasum {} \; > $OUTFILE
@shello
shello / publicip.sh
Created April 7, 2012 12:47
Logs your public IP address and respective hostname into a file
#!/usr/bin/env bash
# Public IP logger r2 (2012/04/10)
# Filipe Rodrigues <shello@shello.org>
# Logs your public IP address into a file
LC_TIME=C # Deactivate for the system time locale
LOGFILE="${HOME}/publicip/publicip.log" # Logfile
CURR_DATE=`date`
@shello
shello / gist:2495224
Created April 26, 2012 02:15
Functions for wrapping text (80 columns default); and a pbpaste/pbcopy shortcut function.
function ncols() { fold -s -w ${1:-80}; }
function pbncols() {
command -v pbpaste >/dev/null 2>&1 && command -v pbcopy >/dev/null
if [[ $? != 0 ]]; then
echo >&2 "pbpaste and pbcopy are required. Aborting."
return 1
fi
pbpaste | ncols $1 | pbcopy
}
@shello
shello / chrome.css
Created May 18, 2012 15:13 — forked from meqif/chrome.css
Travis-CI maximized main column
body#home { background: none; }
div#left { display: none; width: 0px; }
div#main { padding-left: 100px !important; }
#main .tabs { padding-left: 12px; margin-top: 20px; }