This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# change default escape. | |
# Press ` then another key to issue a screen command. | |
# Press ` then ` to create an actual backtick. | |
escape `` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dd if=/dev/urandom of=test_2.bin bs=1M count=100 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!/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. | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |