Skip to content

Instantly share code, notes, and snippets.

@byrongibson
byrongibson / validate_json.py
Created February 27, 2012 03:07 — forked from mkalas/validate_json.py
Python JSON validator
#!/usr/bin/env python
"""
Example usage:
$ f=`cat test.json`; echo -e "$f"; python validate_json.py "$f"
{
"foo": true,
"bar": false,
baz: -23
}
Invalid JSON
@byrongibson
byrongibson / validate_json.py
Created February 27, 2012 03:07 — forked from mkalas/validate_json.py
Python JSON validator
#!/usr/bin/env python -
"""
Example usage:
$ f=`cat test.json`; echo -e "$f"; python validate_json.py "$f"
{
"foo": true,
"bar": false,
baz: -23
}
Invalid JSON
@byrongibson
byrongibson / hac.bash
Created March 2, 2012 21:07 — forked from ehamberg/hac.bash
Script for downloading and combining the chapters of “Ηandbook of applied cryptography” to one pdf file
#!/bin/bash
# downloads all chapters of “handbook of applied cryptography”
# (<http://www.cacr.math.uwaterloo.ca/hac/>) and combines them into one pdf file.
# The resulting file can not be distributed and is only for personal use, as
# per the copyright notice at
# <http://www.cacr.math.uwaterloo.ca/hac/about/copyright-notice.html>.
# Requires ghostscript.
TEMPDIR="/tmp"
@byrongibson
byrongibson / gist:2054763
Created March 17, 2012 03:43
The Zen of R
# I am a scientist who has been using R for about 2 years. Today I achieved a measure of enlightenment into
# the zen of R, and I want to share it with you.
# I was simulating a set of independent random walks, which are formed by a multiplicative process. Here is
# the code I had built up over a few months of working on it and modifying it on and off as research
# questions changed:
TimeSteps <- 1000
Walks <- 100
ErrorMagnitude <- 0.03
@byrongibson
byrongibson / love.py
Created April 3, 2012 20:22 — forked from Lambdanaut/love.py
A Genetic Algorithm that I wrote for Catherine K
#! /usr/bin/python
import random
#goal = "This message evolves like my love for you. I'll always love you, Cat. -Josh <3"
goal = "I Love You Cat"
generations = None
popSize = 25
mutation = 150 #Bigger = Less mutation
<form action='http://act.fightforthefuture.org/page/s/acta-letters' method='post' id='write-letter'> <style> select {width: 300px; font-size: 14px;} button { -moz-box-shadow:inset 0px 1px 0px 0px #caefab; -webkit-box-shadow:inset 0px 1px 0px 0px #caefab; box-shadow:inset 0px 1px 0px 0px #caefab; background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #77d42a), color-stop(1, #5cb811) ); background:-moz-linear-gradient( center top, #77d42a 5%, #5cb811 100% ); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#77d42a', endColorstr='#5cb811'); background-color:#77d42a; -moz-border-radius:6px; -webkit-border-radius:6px; border-radius:6px; border:1px solid #268a16; display:inline-block; color:#ffffff; font-family:arial; font-size:24px; font-weight:bold; padding:7px 5px 7px 5px; text-decoration:none; text-shadow:1px 1px 0px #333; display: block; clear: both; margin-bottom: 10px; width: 300px; cursor:
#!/usr/bin/env bash -
# install haskell GHC to the system via Debian update-alternatives
BIN="/usr/bin"
MAN="/usr/share/man"
GHC="/opt/haskell/ghc/7.4.1"
GHC_BIN="$GHC/bin"
GHC_MAN="$GHC/share/man"
PRIORITY_LEVEL=1200
@byrongibson
byrongibson / index.html
Created March 24, 2013 17:55
Realtime d3.js streamgraph that converts mouse coordinates into input data
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="http://d3js.org/d3.v3.min.js"></script>
<meta charset="utf-8">
</head>
<!-- source: http://lyngbaek.com/real-time-stream-graph.html
random number generator replaced with realtime mouse coordinates. -->

Contract Killer 3

Revised date: 07/11/2012

Between us [company name] and you [customer name]

Summary:

We’ll always do our best to fulfil your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. We’ve no desire to trick you into signing something that you might later regret. What we do want is what’s best for both parties, now and in the future.

@byrongibson
byrongibson / dabblet.css
Created April 27, 2013 02:42
Circular Tooltip (SO)
/**
* Circular Tooltip (SO)
* http://stackoverflow.com/q/13132864/1397351
*/
* { margin: 0; padding: 0; }
body {
overflow: hidden;
background: url(http://theearlcarlson.com/experiments/amTooltip/img/bg.jpg);
}
/* generic styles for button & circular menu */