Skip to content

Instantly share code, notes, and snippets.

View adunsmoor's full-sized avatar

Ahran Dunsmoor adunsmoor

View GitHub Profile
# change default escape.
# Press ` then another key to issue a screen command.
# Press ` then ` to create an actual backtick.
escape ``
@adunsmoor
adunsmoor / gist:e848356a57980ab9f822
Last active December 17, 2018 08:45
closed convex hull in Swift
import UIKit
// Returns a list of points on the convex hull in counter-clockwise order.
// Note: the last point in the returned list is the same as the first one.
//
// https://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain
//
func closedConvexHull(points_ : [CGPoint]) -> [CGPoint] {
// 2D cross product of OA and OB vectors, i.e. z-component of their 3D cross product.
@adunsmoor
adunsmoor / gist:8073405
Created December 21, 2013 18:59
Create file with random contents
dd if=/dev/urandom of=test_2.bin bs=1M count=100
@adunsmoor
adunsmoor / atgrep.tcl
Last active October 14, 2015 00:17
A threaded invocation of grep with a little GUI to display results.
!/bin/env tclsh
# Ahran's Threaded Grep (ATGrep)
#
# This code is license free
# and comes without a warranty.
# If your hard drive melts
# or network crashes
# all I ask is that you don't blame me.
#
@adunsmoor
adunsmoor / quick_histogram.py
Last active October 11, 2015 15:38
Quick and dirty histogram using Matplotlib
# Quick and dirty histogram using Matplotlib
# Reads a file full of numbers and creates a histogram.
import sys
import matplotlib.pyplot as plt
for file in sys.argv[1:]:
with open(file) as f:
values = [float(x) for x in f]
plt.hist(values, bins=100, log=True, label=file)