This file contains 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
/* This was written to show that indexing a map with numbers | |
* formed by putting two uint16's into a single uint32 takes longer | |
* than indexing a map with uint16's in the range [0, 1023] | |
*/ | |
package main | |
import ( | |
"fmt" | |
"time" |
This file contains 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
Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz | |
go version go1.8.3 linux/amd64 |
This file contains 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
// illustrating benign data races in: | |
// | |
// a. one-time flag setting where missing the flag being set is benign (we simply | |
// loop one more time, but in the logic of the program, that's fine) | |
// | |
// b. implementing an array-based queueing lock in which lockers wait on the | |
// value at their array position to be set to 1 | |
package main |
This file contains 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
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const onFinished = require('on-finished'); | |
// it may be necessary to modify the request object in various ways, this can | |
// be done in this function. For example, a `_metrics_gatherer` object is | |
// added to req and req.connection for the purposes of metrics observing functions | |
const modifyReq = (req) => { | |
req._metrics_gatherer = {}; | |
if (!req.connection._metrics_gatherer) { |
This file contains 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
const getSdk = require('balena-sdk'); | |
const balena = getSdk({ | |
apiUrl: "https://api.balena-cloud.com/", | |
dataDirectory: "/tmp" | |
}); | |
const key = process.env.BALENA_KEY; | |
const appId = parseInt(process.env.APP, 10); | |
const countResource = (resource) => { | |
return balena.pine.get({ | |
resource: resource + '/$count', |
This file contains 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
// MISSION: OPERATION TRANS LIBERATION | |
// | |
// USAGE: | |
// 1) Navigate to https://new.reddit.com/r/place/ | |
// 2) Open the "Developer Tools" (CTRL+SHIFT+I) | |
// 3) Make sure the context dropdown is set to: "embed" (https://i.imgur.com/YfCY4WP.png) | |
// 4) Paste the code below in the console and hit enter. (https://i.imgur.com/YAHjJXP.png) | |
// 5) Leave window open and a pixel will be placed in the set | |
// range every time your timer goes down |