Skip to content

Instantly share code, notes, and snippets.

Avatar

Jaeho Shin netj

View GitHub Profile
@netj
netj / take-a-break-with
Created May 17, 2010
Take-a-Break script for the Mac user's health
View take-a-break-with
#!/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
an effective tool for instilling vocabularies into your brain
View blinker
#!/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 Jun 13, 2010
Mark empty dirs in a git repo with .gitignore files
View git-mark-empty-dirs
#!/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 Jun 13, 2010
Substitute contents and names of given files
View customize
#!/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 Sep 19, 2021
memusg -- Measure memory usage of processes
View memusg
#!/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 Aug 16, 2010
CSV to TSV python one-liner
View csv2tsv.py
#!/usr/bin/env python
import sys,csv
for row in csv.reader(sys.stdin):
print "\t".join(row)
@netj
netj / a.txt
Created Sep 1, 2010
Genetic Algorithm for Number Bi-partitioning
View a.txt
100000
6488
13757
16483
29204
31021
70
1887
3704
5522
@netj
netj / netj-icon.js
Created Oct 9, 2010
my logo icon drawn with Javascript on an HTML5 canvas
View netj-icon.js
// 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 Mar 26, 2011
AppleScript that sets text encoding (xattr) of currently selected files in Finder (to UTF-8)
View SetTextEncodingToUTF8.scpt
#!/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 Apr 10, 2011
한국 토렌트 사이트의 자바스크립트 다운로드 링크 변환 북마크릿
View gist:912261
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*/};