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/bash | |
# Uses gzip to calculate crude entropy of a file or stdin | |
# | |
# usage: | |
# | |
# entropy [file] | |
# | |
# probably downloaded from https://gist.github.com/2571452 |
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
#!/usr/bin/env bash | |
# hook to enforce that current branch is up-to-date with latest | |
# changes from master before committing | |
# put me in .git/hooks and make me executable | |
# the output of rev-list in the following test will be empty if there | |
# are no commits in master that aren't in the current branch |
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
(ns arc.core | |
(:use compojure.core) | |
(:require [compojure.route :as route] | |
[compojure.handler :as handler] | |
[ring.util.response :as response] | |
[ring.adapter.jetty :as jetty])) | |
(def route-map (ref {})) | |
(def ^:dynamic *params* nil) |
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
<html> | |
<head> | |
<title>Dynamic Stacked Bar Chart using d3.js</title> | |
<script src="http://mbostock.github.com/d3/d3.v2.js"></script> | |
<style> | |
rect.a { | |
fill: green; | |
} | |
rect.b { | |
fill: orange; |
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/bash | |
# strings together all of its arguments into a Java classpath, useful for | |
# grabbing all of the jars in a directory like so: | |
# classpath.sh lib/*.jar | |
# | |
DELIM= | |
CLASSPATH= | |
for PATH_PART in "$@" | |
do |
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/sh | |
untrackedFiles=$(git ls-files --others --exclude-standard) | |
if [ ! -z "$untrackedFiles" ] | |
then | |
echo "There are untracked files in the working tree:" | |
echo "$untrackedFiles" | |
echo "" | |
echo "Are you sure you aren't forgetting something?" |
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
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
# prints a sparkline in the terminal using the supplied list of numbers | |
# examples: | |
# spark.rb 10 20 30 100 90 80 | |
# spark.rb 1 2 0.4 0.1 1.3 0.7 | |
@ticks = %w[▁ ▂ ▃ ▄ ▅ ▆ ▇] | |
values = ARGV.map { |x| x.to_f } |
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
(ns util.markdown | |
(import (java.io | |
BufferedReader | |
InputStreamReader))) | |
(defn markdown | |
[s] | |
(let [builder (java.lang.ProcessBuilder. ["Markdown.pl"]) | |
proc (.start builder) | |
stdin (.getOutputStream proc) |
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
(defn add-component | |
[system entity component data] | |
(-> system | |
(update-in [:identity entity] (comp set conj) component) | |
(assoc-in [component entity] data))) | |
(defn delete-component | |
[system entity component] | |
(-> system | |
(update-in [:identity entity] disj component) |
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
- (NSIndexPath *)nextIndexPath:(NSIndexPath *)i | |
{ | |
// apologies to any maintainer but this was some code golf going on in #iphonedev | |
id t=_tableView; | |
int s,r,n;s=i.section;r=(i.row+1)%[t numberOfRowsInSection:s];n=[t numberOfSections]; | |
if(!r)for(;s<n&&![t numberOfRowsInSection:s+++1];); | |
return s==n?nil:[NSIndexPath indexPathForRow:r inSection:s]; | |
} |
NewerOlder