Skip to content

Instantly share code, notes, and snippets.

@jackyueq
jackyueq / gist:11243002
Created April 24, 2014 05:53
Colorful git
git config --global color.branch auto
git config --global color.diff auto
git config --global color.interactive auto
git config --global color.status auto
# Two things are important to note:
#
# 1) The code is fugly, because it was a JavaScript/iPad experiment.
# I know that it is ugly, so pretty please don't comment on that part.
# 2) I tried to use as many CoffeeScript features as possible,
# including but not limited to list comprehensions,
# heredocs, destructuring assignment and also the "do" operator
#
# I welcome comments about stuff that is not CoffeeScripty enough, or what I should
# write differently.
# Two things are important to note:
#
# 1) The code is fugly, because it was a JavaScript/iPad experiment.
# I know that it is ugly, so pretty please don't comment on that part.
# 2) I tried to use as many CoffeeScript features as possible,
# including but not limited to list comprehensions,
# heredocs, destructuring assignment and also the "do" operator
#
# I welcome comments about stuff that is not CoffeeScripty enough, or what I should
# write differently.
@jackyueq
jackyueq / gist:5257781
Created March 27, 2013 20:35
Use youdao fanyi in bash
function t(){ wget -qO- "http://fanyi.youdao.com/openapi.do?keyfrom=leecade&key=54015339&type=data&doctype=json&version=1.1&q=$1" | grep -oP '(?<="explains":\[")[^"]*'; }
@jackyueq
jackyueq / Remove empty files
Created March 17, 2013 00:34
Remove empty files
find . -maxdepth 1 -type f -empty -exec rm {} \;
@jackyueq
jackyueq / gist:5175042
Last active December 15, 2015 00:48
FLAC 2 CD
#!/bin/sh
#
# flac2cd.sh - Recreate a CD from FLAC file $1.
# Written 4 Apr 2007 by M. Dickerson (too trivial for a license,
# don't you think?)
set -e
ME=`basename $0`
AUDIO=`tempfile -p $ME`
@jackyueq
jackyueq / gist:5007572
Created February 21, 2013 19:49
Add utf-8 support to synology dsm
http://www.xn--brwolff-5wa.de/tech-notes/synology-diskstation-howto-set-locale.txt
I've been using a Synology Diskstation DS209j to backup data via rsync. However, the locale on my laptop (the source of the backups) is de_DE.utf8, and on the Diskstation no such locale (in fact, no utf-8 locale at all) is available by default. This becomes a problem as soon as you're dealing with file names containing "non-standard" characters such as German umlauts. Here's what I did to remedy the problem, largely based on a very useful howto at <http://forum.synology.com/wiki/index.php/CrashPlan_Headless_Client>:
log in to the Diskstation as root
cd /volume1/@tmp
uname -a # in order to find out what system you're at, and which tool chain to download from http://sourceforge.net/projects/dsgpl/files/; mine was <http://sourceforge.net/projects/dsgpl/files/DSM%203.2%20Tool%20Chains/Marvell%2088F628x%20Linux%202.6.32/gcc421_glibc25_88f6281-GPL.tgz/download>
wget $the_url_found_in the_previous_step
tar -xzvf $the_file_thus_down