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
# 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 |
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> | |
<meta http-equiv="X-UA-Compatible" content="IE-Edge"> | |
<style> | |
body { visibility: hidden; } | |
img { visibility: visible; } | |
</style> | |
<script src="elephant3.jpg"></script> | |
</head> | |
<body> |
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
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) |
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
// 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') { |
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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
body { | |
margin: 0; | |
background: #111; | |
min-width: 960px; | |
} |
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 | |
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) |
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 | |
MIN=0 | |
MAX=1 | |
STEPS=100 | |
RANGE=$(echo "$MAX - $MIN" | bc -l) | |
INC=$(echo "$RANGE / $STEPS" | bc -l) | |
fade () { |
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
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(); |
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
// 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) { |
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
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); |