Skip to content

Instantly share code, notes, and snippets.

Shane Hanna shanna

Block or report user

Report or block shanna

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am shanna on github.
  • I am shanna (https://keybase.io/shanna) on keybase.
  • I have a public key ASB7WctqxheSQaiFSOvDLCvRe47lFZMirPn1NQiv4ePUcQo

To claim this, I am signing this object:

@shanna
shanna / main.c
Created Mar 6, 2017
Minimal webkit2gtk segfault on macOS runs on Linux.
View main.c
#include <webkit2/webkit2.h>
#include <JavaScriptCore/JavaScript.h>
int main(int argc, char **argv) {
gtk_init(&argc, &argv);
GtkWidget *main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
GtkWidget *webkit_view = webkit_web_view_new();
gtk_container_add(GTK_CONTAINER(main_window), webkit_view);
@shanna
shanna / example.rb
Last active Feb 8, 2017
Jaccard coeff against shingles.
View example.rb
require 'shingles'
compare = %w{
foo foo
foo bar
baz boz
foofoo foobar
}.each_slice(2)
compare.each do |a, b|
@shanna
shanna / brokenimage.js
Created Oct 19, 2016
Broken image JS.
View brokenimage.js
// MIT https://github.com/alexrabarts/jquery-brokenimage minus the jquery.
function BrokenImage(selector, options) {
'use strict';
options = options || {};
var defaults = {
timeout: 2500
};
for (var key in defaults) {
@shanna
shanna / pg-install
Created Sep 6, 2016
Postgres install from source on OSX when homebrew won't give you a specific version.
View pg-install
#!/usr/bin/env bash
set -e
# Homebrew homebrew/versions was broken when I went to install postgres.
# This shell script just documents my install from source.
release=9.4.6
prefix=$HOME/local
mkdir -p $prefix
@shanna
shanna / psql-migrate
Last active May 23, 2016
Postgres migration script.
View psql-migrate
#!/usr/bin/env sh
set -eu
if [ $# -ne 0 ]; then
cat <<-USAGE
psql-migrate
Takes a sorted list of filenames from stdin and writes psql migrations sql
to stdout.
@shanna
shanna / short-prompt.sh
Last active May 4, 2016
A short, smart, prompt.
View short-prompt.sh
# [ -e ~/.config/short-prompt.sh ] && source ~/.config/short-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE=true
__git_ps1() { PS1="$1$2"; }
[ -e ~/.config/git-prompt.sh ] && source ~/.config/git-prompt.sh
__short_ps1() {
local exit=$?
local __short_ps1_host=""
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
@shanna
shanna / go-env
Last active May 3, 2016
Symlink Go packages into local project directory.
View go-env
#!/usr/bin/env sh
# Setup Go environment.
#
# source ~/local/bin/go-env
# http://superuser.com/questions/39751/add-directory-to-path-if-its-not-already-there
__util_env_path_prepend() {
if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
PATH="$1:$PATH"
@shanna
shanna / jlink
Created Oct 25, 2015
jlink wrapper script for debugging and flashing.
View jlink
@shanna
shanna / README.md
Last active Aug 29, 2015
BuildKite Systemd Target
View README.md

BuildKite Systemd Target

Debian Jessie buildkite agent when networking is up.

/etc/systemd/system/buildkite-agent.service

You can’t perform that action at this time.