Skip to content

Instantly share code, notes, and snippets.

View netj's full-sized avatar

Jaeho Shin netj

View GitHub Profile
@kamermans
kamermans / docker_ephemeral_create.sh
Last active September 22, 2022 18:32
AWS EC2 script to mount Instance Store 0 and 1 as Docker temp and volume storage
#!/bin/sh -e
# This script will DESTROY /dev/xvdb and /dev/xvdc and remount them
# for Docker temp and volume storage.
# It is intended for EC2 instances with 2 ephemeral SSD instance stores
# like the c3.xlarge instance type.
service docker stop || true
# Setup Instance Store 0 for Docker Temp
# (set in /etc/default/docker)
#!/usr/bin/env bash
size=1024 # MB
mount_point=$HOME/tmp
name=$(basename "$mount_point")
usage() {
echo "usage: $(basename "$0") [mount | umount | remount | check | orphan]" \
"(default: mount)" >&2
}
@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
#!/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 / 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:
@andyferra
andyferra / github.css
Created April 30, 2012 02:11
Github Markdown CSS - for Markdown Editor Preview
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
@davatron5000
davatron5000 / gist:2254924
Created March 30, 2012 20:57
Static Site Generators

Backstory: I decided to crowdsource static site generator recommendations, so the following are actual real world suggested-to-me results. I then took those and sorted them by language/server and, just for a decent relative metric, their Github Watcher count. If you want a heap of other projects (including other languages like Haskell and Python) Nanoc has the mother of all site generator lists. If you recommend another one, by all means add a comment.

Ruby

@emanuelez
emanuelez / git_speed.md
Last active March 17, 2024 19:03
Git Speed

How Fast is Git?

The web is full of benchmarks showing the supernatural speed of Git even with very big repositories, but unfortunately they use the wrong variable. Size is not important, but the number of files in the repository really is!

Why is that? Well, that's because Git works in a very different way compared to Synergy. You don't have to checkout a file in order to edit it; Git will do that for you automatically. But at what price?

The price is that for every Git operation that requires to know which files changed (git status, git commmit, etc etc) an lstat() call will be executed for every single file

Wow! So how does that perform on a fairly large repository? Let's find out! For this example I will use an example project, which has 19384 files in 1326 folders.

@aemkei
aemkei / LICENSE.txt
Last active April 12, 2024 21:27 — forked from 140bytes/LICENSE.txt
Binary Tetris - 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE