Skip to content

Instantly share code, notes, and snippets.

View netj's full-sized avatar

Jaeho Shin netj

View GitHub Profile
@netj
netj / take-a-break-with
Created May 17, 2010 06:52
Take-a-Break script for the Mac user's health
#!/bin/bash
# take-a-break-with -- Take-a-Break script for the Mac user's health
#
# Schedule calling this script regularly from your crontab:
#
# */60 * * * * take-a-break-with Dashboard
#
# When a Growl bubble comes up, click it and take a break! :)
#
# You need to get and install Growl from: http://growl.info/
@netj
netj / blinker
Created May 25, 2010 06:18
an effective tool for instilling vocabularies into your brain
#!/bin/bash
# The "Blinker" (or "깜빡이" in Korean) for Mac
# an effective tool for instilling vocabularies into your brain
#
# Usage: blinker [-OPTION...] SET...
#
# SET is the path to a file where each of its line contains a word and its
# definition separated by tab character. You can get lots of quality sets
# from http://quizlet.com/.
#
@netj
netj / git-mark-empty-dirs
Created June 13, 2010 11:17
Mark empty dirs in a git repo with .gitignore files
#!/usr/bin/env bash
# git-mark-empty-dirs -- Mark empty dirs in a git repo with .gitignore files
# Author: Jaeho Shin <netj@sparcs.org>
# Created: 2009-12-03
set -e
remove-or-mark() {
local d=$1; shift
interact() {
echo "Found empty dir: \`$d'"
@netj
netj / customize
Created June 13, 2010 11:21
Substitute contents and names of given files
#!/usr/bin/env bash
# customize -- Substitute contents and names of given files
#
# Usage:
# customize DEST [FILE...] <<RULES
# Name=Foo
# Version=1.0
# RULES
#
#
@netj
netj / memusg
Last active January 29, 2024 15:04
memusg -- Measure memory usage of processes
#!/usr/bin/env bash
# memusg -- Measure memory usage of processes
# Usage: memusg COMMAND [ARGS]...
#
# Author: Jaeho Shin <netj@sparcs.org>
# Created: 2010-08-16
############################################################################
# Copyright 2010 Jaeho Shin. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
@netj
netj / csv2tsv.py
Created August 16, 2010 14:38
CSV to TSV python one-liner
#!/usr/bin/env python
import sys,csv
for row in csv.reader(sys.stdin):
print "\t".join(row)
@netj
netj / a.txt
Created September 1, 2010 06:53
Genetic Algorithm for Number Bi-partitioning
100000
6488
13757
16483
29204
31021
70
1887
3704
5522
@netj
netj / netj-icon.js
Created October 9, 2010 15:13
my logo icon drawn with Javascript on an HTML5 canvas
// netj's icon with HTML5 canvas
function drawIconOnCanvas(w, opacity, canvas, a) {
if (canvas.getContext) {
var c = canvas.getContext("2d");
// name some constants
canvas.width = canvas.height = w;
c.clearRect(0, 0, w, w);
var o = w/12;
var l = (w-3*o)/2;
@netj
netj / SetTextEncodingToUTF8.scpt
Created March 26, 2011 03:43
AppleScript that sets text encoding (xattr) of currently selected files in Finder (to UTF-8)
#!/usr/bin/osascript
# AppleScript that sets text encoding (xattr) of currently selected files in Finder (to UTF-8)
# Author: Jaeho Shin <netj@sparcs.org>
# Created: 2011-03-25
# See-Also: http://vim.1045645.n5.nabble.com/MacVim-file-encoding-and-Quicklook-td1216113.html
# See-Also: http://xahlee.org/comp/OS_X_extended_attributes_xattr.html
tell application "Finder"
set names to ""
repeat with f in (selection as alias list)
@netj
netj / gist:912261
Created April 10, 2011 11:17
한국 토렌트 사이트의 자바스크립트 다운로드 링크 변환 북마크릿
javascript:var%20s=document.createElement("script");s.src="http://code.jquery.com/jquery-1.5.2.js";document.body.appendChild(s);s.onload=function(){$('a[href^="javascript:file_download("]').each(function(){this.href=eval("var%20file_download=function(a,b){return%20a/*+'#'+b*/;};"+decodeURI(this.href.substring("javascript:".length)));});/*add%20more%20code%20here*/};