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
function alertTerminal(){ | |
console.log("\007"); | |
} |
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
// The Babylonian Method | |
// http://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method | |
// @param n - the number to compute the square root of | |
// @param g - the best guess so far (can omit from initial call) | |
function squirt(n, g) { | |
if (!g) { | |
// Take an initial guess at the square root | |
g = n / 2.0; | |
} | |
var d = n / g; // Divide our guess into the number |
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
var crypto = require('crypto') | |
var request = require('request') | |
var url = require('url') | |
var irc = require('./IRC/lib/irc') // https://github.com/gf3/IRC-js | |
var ntwitter = require('ntwitter') | |
var twitter = require('twitter') | |
var qs = require('querystring') | |
// separate accounts to post and search because twitter was sending me 500s | |
// when I tried to use the same oauth creds for both twitter() and ntwitter() |
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
/** | |
* Mark and Sweep Garbage Collection technique. | |
* MIT Style License | |
* by Dmitry Soshnikov | |
*/ | |
// This diff describes the simplest version of mark and sweep | |
// GC in order to understand the basic idea. In real practice the | |
// implementation can be much tricker and optimized. |
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
/** | |
* Automatic Reference Counting (ARC) Garbage Collection technique. | |
* | |
* This diff describes Reference counting GC technique. | |
* See also previous lesson on Mark and Sweep GC: | |
* https://gist.github.com/4391763 | |
* | |
* by Dmitry Soshnikov <dmitry.soshnikov@gmail.com> | |
* MIT Style License | |
*/ |
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
upstream chef_server { | |
server 127.0.0.1:4000 fail_timeout=0; | |
} | |
upstream chef_server_webui { | |
server 127.0.0.1:4040 fail_timeout=0; | |
} | |
server { | |
listen 443 default ssl; |
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
Looking at the preceding token when the lexer points to a '/' | |
character is insufficient to determine which context it's in. In | |
fact, you need to look at an arbitrary number of preceding tokens | |
to figure it out. This example demonstrates a case where we can | |
pump up the number of preceding tokens to an arbitrary size | |
before you can disambiguate your syntactic context. |
Provided that you already have a file or stream segmenter generating your .m3u8 playlist and .ts segment files (such as the ffmpeg 'hls' muxer), this little node server will serve up those files to an HLS compatible client (e.g. Safari). If you're using node for your streaming app already, this obviates the need to serve the HLS stream from a separate web server.
loosely based on https://gist.github.com/bnerd/2011232
// loosely based on https://gist.github.com/bnerd/2011232
// requires node.js >= v0.10.0
// assumes that HLS segmenter filename base is 'out'
// and that the HLS playlist and .ts files are in the current directory