Skip to content

Instantly share code, notes, and snippets.

View ernstki's full-sized avatar

Kevin Ernst ernstki

  • Earth, Sol
View GitHub Profile
@ernstki
ernstki / post-receive.passenger
Created July 14, 2014 04:51
Sample Git post-receive hook for a Rails/mod_rails app
#!/bin/bash
set -x
export GIT_WORK_TREE=/var/www/tm
export RAILS_ENV=mod_rails
if [ ! -d "$GIT_WORK_TREE" ]; then
echo "ACK! The specified working tree ($GIT_WORK_TREE) doesn't exist. Quitting." >&2
exit 3
fi
git checkout -f dev
@ernstki
ernstki / quadratic.html
Last active August 29, 2015 14:04 — forked from anonymous/jsbin.qoxalize.html
JavaScript source to create quadratic curves between successive points drawn with the mouse
<!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery-2.1.0.min.js"></script>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<meta charset=utf-8 />
<title>quadraticCurveTo given three points</title>
<style>
body { background:#000; margin:0px; padding:0px; overflow:hidden; }
@ernstki
ernstki / ldap-query-last-first.sh
Last active August 29, 2015 14:05
Query Davmail LDAP server for "LastName, FirstName" from input file and prepare output suitable for Listserv bulk subscription
#!/bin/bash
# Query an LDAP server (assuming OWA via DavMail) for "LastName, FirstName"
# given a list of names from an input file passed on the command line; output
# names and emails in a format acceptable to Listserv for bulk subscription.
#
# The input names can be copied from a Blackboard course's Tools -> Send Email
# -> All Users. These are semicolon-separated, so replace these with newlines
# using a global search-and-replace (e.g., in Vi: :%s/; \?/<CTRL+V><CTRL+M>/g,
# where <CTRL+X> is a literal keypress, holding down the Control key).
#
@ernstki
ernstki / index.html
Created January 25, 2015 12:28
Appearing/disappearing message box with CSS transitions only // source http://jsbin.com/yoyada
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Appearing/disappearing message box with CSS transitions only" />
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
.box {
border: 1px solid black;
height: 5em;

Keybase proof

I hereby claim:

  • I am ernstki on github.
  • I am ernstki (https://keybase.io/ernstki) on keybase.
  • I have a public key whose fingerprint is 13CE B335 8962 AF0C 4489 FD84 DE5F FAB6 821A 05EB

To claim this, I am signing this object:

@ernstki
ernstki / udacity-cs344-cmake-fixes-kme.diff
Last active November 18, 2016 19:54
Patch file to get Udacity CS344 course materials to compile on OSC's Oakley cluster
--- CMakeLists.txt.orig 2016-11-13 18:49:46.528795000 -0500
+++ CMakeLists.txt 2016-11-13 18:52:36.459490000 -0500
@@ -21,7 +21,6 @@
# to make sure more people can easily run class code without knowing
# about this compiler argument
set(CUDA_NVCC_FLAGS "
- -ccbin /usr/bin/clang;
-gencode;arch=compute_30,code=sm_30;
-gencode;arch=compute_35,code=sm_35;
-gencode;arch=compute_35,code=compute_35;
@ernstki
ernstki / relashify.sed
Created December 15, 2017 04:59
reslashify - a sed script to reverse slashes in pathnames (DOS <--> Unix)
#!/usr/bin/env sed -f
# replace all forward slashes only if there are no backslashes
# (i.e., convert Unix-style pathnames to DOS/Windows-style ones)
/\\/! s_/_\\_g
# branch (to the end) if any substitutions have been made at this point,
# to prevent the next pattern from undoing what the first one did
t
@ernstki
ernstki / dot-gitconfig-essentials.sh
Created April 24, 2018 21:12
.gitconfig essentials
# Use 'vimdiff' as the diff tool. See also git-diff(1)
# '-y' means don't prompt for every invocation
git config --global alias.vimdiff 'difftool -y -t vimdiff'
# A concise, formatted commit log
# Source: https://www.youtube.com/watch?v=W39CfI3-JFc
git config --global alias.lol 'log --graph --all --decorate --oneline'
# Colorize output (really helpful)
# Source: https://rogerdudler.github.io/git-guide/#hints
@ernstki
ernstki / ffhist.py
Last active May 12, 2018 07:35
List, filter, and sort your Firefox profile's browsing history; requires Python 3.5 and the Click library (click.pocoo.org)
#!/usr/bin/env python
# coding: utf-8
#
# List, filter, and sort records from the SQLite database holding your Firefox
# profile's browsing history ('<profile>/places.sqlite#moz_places')
#
# In order to point this script at the correct Firefox profile, either use
# the '-p' option, or set an environment variable 'FFPROFILE' that is the
# complete path to the profile ('9ibBeri$h.default', for example)
#
@ernstki
ernstki / dropshadow.sh
Created July 11, 2018 19:35
Create a drop shadow for screenshots using ImageMagic's 'convert'
# add a 1-pixel #777 border and a 2-pixel offset drop shadow of 5 px radius
#
# source: https://stackoverflow.com/a/7136561
function dropshadow() {
# inner border color and radius
local ibc=${DS_INNER_BORDER_COLOR:-#777}
local ibr=${DS_INNER_BORDER_RADIUS:-1}
# drop shadow color, alpha, width and offset
local dsc=${DS_DROP_SHADOW_COLOR:-black}