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 node | |
| "use strict"; | |
| var child_process = require("child_process"); | |
| var fs = require("fs"); | |
| var path = require("path"); | |
| var strftime = require("strftime"); | |
| var util = require("util"); | |
| var pjson = JSON.parse(fs.readFileSync("package.json", "utf8")); |
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
| const callback = (n) => { | |
| console.log(this.sum + n); | |
| }; | |
| class Adder { | |
| constructor(sum) { | |
| this.sum = sum; | |
| } | |
| work(callback) { |
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 node | |
| const SKULLS = [` | |
| ▒▒▒▒▒▒▒ | |
| ▒▒▓▓▓▓▓▓▓▓▓▓▓▒▒ | |
| ▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒ | |
| ▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒ | |
| ▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒ | |
| ▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒ | |
| ▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒ |
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 Promise = require('bluebird'); | |
| function stream() { | |
| var active = true; | |
| var count = 0; | |
| var loop = function () { | |
| if (!active) return; | |
| count++; |
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 node | |
| // determine how many rounds beats 100ms | |
| function calibrate(name, f) { | |
| console.log("Calibrating " + name + " ..."); | |
| var rounds = 1, done = false, startTime, endTime; | |
| while (!done) { | |
| rounds *= 10; | |
| startTime = Date.now(); | |
| for (var i = 0; i < rounds; i++) 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
| # | |
| # ssh supports socks proxy forwarding, built-in. | |
| # | |
| # on a mac, a socks proxy is setup in: | |
| # System Preferences -> Network -> Advanced -> Proxies -> SOCKS Proxy | |
| # chrome, at least, supports this by default. make sure, in "advanced settings", | |
| # it says something like: | |
| # "Google Chrome is using your computer's system proxy settings to connect | |
| # to the network." | |
| # |
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
| /** | |
| * The state (in a hobo bindle) to be carried through the execution context. | |
| */ | |
| protected final case class Bindle(requestId: String, tracing: Boolean) | |
| object AnnotatedExecutionContext { | |
| private val localBindle = new ThreadLocal[Bindle]() | |
| private val localExecutionContext = new ThreadLocal[AnnotatedExecutionContext]() { | |
| override def initialValue() = new AnnotatedExecutionContext(ExecutionContext.Implicits.global) | |
| } |
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
| // patch up case where scala might not complete a future when the thread-pool is full. | |
| // [Promise.scala:40](https://github.com/scala/scala/blob/v2.10.4/src/library/scala/concurrent/impl/Promise.scala#L40) | |
| override def prepare = new ExecutionContext { | |
| val context = wrapped.prepare | |
| var wasRunning: Option[Runnable] = None | |
| def execute(runnable: Runnable) { | |
| wasRunning = Some(runnable) | |
| context.execute(runnable) |
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
| void sighandle(int signal, struct __siginfo *siginfo, void *unused) { | |
| ucontext_t *uc = (ucontext_t *)unused; | |
| int reg_count = sizeof(uc->uc_mcontext->__ss) / sizeof(uint64_t); | |
| uint64_t *reg_table = (uint64_t *)&uc->uc_mcontext->__ss; | |
| for (int i = 0; i < reg_count; i++) { | |
| printf("reg%d: %llx\n", i, reg_table[i]); | |
| if (reg_table[i] == uc->uc_mcontext->__es.__faultvaddr) { | |
| printf("PATCHING to %p\n", &whatever); | |
| reg_table[i] = (uint64_t)&whatever; | |
| } |
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
| # | |
| # fish config file | |
| # | |
| function fish_greeting | |
| echo (set_color 0b0)f(set_color 0b2)i(set_color 0a4)s(set_color 0a8)h(set_color 0aa) \>(set_color 08c)\<(set_color 09f)\>(set_color normal) | |
| end | |
| function fish_title | |
| echo (basename $PWD)/ | |
| end |