Skip to content

Instantly share code, notes, and snippets.

View builder.sh
# IMPORTANT - CHANGE ME (unless you have the Chromebook Pixel 2015)
export BOARD=samus
sudo aptitude install -y git-core gitk git-gui subversion curl
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=`pwd`/depot_tools:"$PATH"
cat > /tmp/sudo_editor <<EOF
#!/bin/sh
@christianbundy
christianbundy / stegosploit.html
Last active Aug 29, 2015
Source HTML for Stegosploit proof-of-concept by Saumil Shah.
View stegosploit.html
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE-Edge">
<style>
body { visibility: hidden; }
img { visibility: visible; }
</style>
<script src="elephant3.jpg"></script>
</head>
<body>
View test-rabbit-train.py
def answer(x):
len_x = len(x)
modifier = (sum(x) / float(len_x)) % 1
modifier = modifier if modifier <= 0.5 else 1 - modifier
return int(len_x - len_x * modifier)
def expect(expected, actual):
assert expected is actual, \
"expected: {}, actual {}".format(expected, actual)
@christianbundy
christianbundy / auto-google-foobar.js
Created Apr 29, 2015
Probably automatically gets you into Google Foobar. Probably.
View auto-google-foobar.js
// to be run on https://docs.python.org/3.5/reference/
// (probably works on other versions of the docs) (probably)
var topics = [];
var links = document.getElementsByTagName("a");
for (var i in links) {
if (links.hasOwnProperty(i)) {
var link = links[i];
var text = link.innerText;
if (typeof text === 'string') {
View trippy.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
margin: 0;
background: #111;
min-width: 960px;
}
View program-timer.sh
#!/usr/bin/env bash
trap 'exit' ERR # exit on error (better than `set -e`)
set -x # echo commands before running
set -u # throw error if an unbound variable is called
BASEDIR=$(cd $(dirname $0) && pwd) # path to directory for itself
LOGDIR="$BASEDIR/times" # directory for logging
LOGFILE="$LOGDIR/times.txt" # file for logging (within $LOGDIR)
View pulse.sh
#!/bin/bash
MIN=0
MAX=1
STEPS=100
RANGE=$(echo "$MAX - $MIN" | bc -l)
INC=$(echo "$RANGE / $STEPS" | bc -l)
fade () {
View stress-test.js
var system = require('system');
var address = 'http://stress-test.meteor.com';
var i = 0;
var stopping = false;
var newThread = function () {
console.log(i++);
var t = Date.now();
@christianbundy
christianbundy / exports.js
Last active Aug 29, 2015
Export variables to the global namespace with `module.exports` in the browser (or anywhere else). Example in the comments!
View exports.js
// Initialize an empty module object
module = {};
// Functions created this way don't inherit strict mode
exports = Function('return this')();
// Define what happens when you try to get or set `module.exports`
Object.defineProperty(module, 'exports', {
// Extend the top-level object with the object that's passed
set: function (obj) {
View strict.js
var strict = function (fn) {
'use strict';
var args;
var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
var ARG_NAMES = /([^\s,]+)/g;
var fnStr = fn.toString().replace(STRIP_COMMENTS, '');
args = fnStr.slice(fnStr.indexOf('(')+1, fnStr.indexOf(')')).match(ARG_NAMES);