Skip to content

Instantly share code, notes, and snippets.

View netj's full-sized avatar

Jaeho Shin netj

View GitHub Profile
@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 / moveAndResize.applescript
Created June 10, 2012 05:08
A piece of AppleScript for changing the size and position of windows
-- moveAndResize -- a piece of AppleScript for changing the size and position of windows
-- Author: Jaeho Shin <netj@sparcs.org>
-- Created: 2012-06-09
(*
Running the following line will move and resize all windows of that application:
tell application "Finder" to my moveAndResize(x,y, windows, w,h)
For x,y,w,h, you can give:
#!/usr/bin/env bash
# mosh-server wrapper for Kerberos/AFS home environment
#
# Author: Jaeho Shin <netj@cs.stanford.edu>
# Created: 2014-04-25
# Requires: readlink in GNU coreutils
set -eu
self=$(readlink -f "$0")
next=$(type -ap mosh-server | xargs -L1 readlink -f |
@netj
netj / remocon
Last active May 21, 2018 01:10
MOVED TO: https://github.com/netj/remocon since 2018-05
#!/usr/bin/env bash
# remocon -- run given command remotely, replicating local git work tree on a remote host, and downloading remote changes if needed
#
# Author: Jaeho Shin <netj@sparcs.org>
# Created: 2018-03-08
##
set -euo pipefail
error() { echo >&2 "📡 ‼️ " "$@"; false; }
warning() { echo >&2 "📡 ⚠️ " "$@"; }
@netj
netj / exshell
Last active September 21, 2018 14:23
#!/usr/bin/env bash
# exshell -- a handy way to use command-line formulae's output to augment a TAB-separated input
#
# Synopsis:
# $ cat a.txt
# USA United States of America
# India Republic of India
# South_Korea Republic of Korea (ROK)
#
# $ exshell <a.txt \
@matthewmccullough
matthewmccullough / gist:47267
Created January 15, 2009 05:15 — forked from halbtuerke/gist:31934
Show Git dirty status in your Unix bash prompt (symbols not compatible with CygWin)
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
COLOR_NONE="\[\e[0m\]"
@joelkuiper
joelkuiper / TextHighlight
Last active October 21, 2020 07:25
A example class for adding highlights to PDFs based on a Pattern or String
/*
* Copyright 2014 Joël Kuiper
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@joelkuiper
joelkuiper / gist:9eb52555e02edb653dcf
Last active March 22, 2021 12:58
highlight a pattern with PDFBox
The PDFTextAnnotator will accept a PDF and a pattern, it will highlight all occurances of that pattern in the document.
It inherits from the PDFTextStripper (so things like start end end page should still be configurable)
See the App file for a basic usage example
@netj
netj / aws-ssm-ssh-proxy-magic.sh
Last active July 1, 2021 04:52
a nifty script for ssh'ing into any AWS SSM-enabled EC2 instance with no extra manual setup
#!/usr/bin/env bash
# ~/.ssh/aws-ssm-ssh-proxy-magic.sh -- a nifty script for ssh'ing into any AWS SSM-enabled EC2 instance with no extra manual setup
#
# Author: Jaeho Shin <netj@sparcs.org>
# Created: 2021-02-01
# See also:
# - https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-getting-started-enable-ssh-connections.html
# - https://gist.github.com/d9006a823163d7662d8ff105c9a49e0e
#
# 1. Copy this script to ~/.ssh/aws-ssm-ssh-proxy-magic.sh
@netj
netj / MacOSXDefaultFontFallbacksChanger.command
Created July 22, 2011 11:53
맥의 기본 한글 글꼴을 바꿔주는 스크립트 - A script for changing Mac OS X's default font fallbacks
#!/usr/bin/env bash
# A script for changing Mac OS X's default fonts
# Author: Jaeho Shin <netj@sparcs.org>
# Created: 2011-07-22
### MacOSXDefaultFontFallbacksChanger #########################################
## Mac OS X 기본 글꼴 설정 변경 도구 – 1.2.1 (2012-08)
## http://netj.github.com/MacOSXDefaultFontFallbacksChanger
###############################################################################