Skip to content

Instantly share code, notes, and snippets.

@paolorossi
paolorossi / html5-video-streamer.js
Created March 7, 2012 13:21
Node.js HTML5 video streamer
/*
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js
*/
var http = require('http'),
fs = require('fs'),
util = require('util');
http.createServer(function (req, res) {
var path = 'video.mp4';
@connor
connor / package.json
Created May 28, 2012 04:57
Domai.nr node module package.json file
{
"name": "Domai.nr"
, "version": "1.0.0"
, "description": "A dead-simple way to utilize Domai.nr's JSON API"
, "keywords": [
"domainr"
, "domains"
, "search"
, "domain"
]

on the guest SmartOS VM

pkg_add http://pkgsrc.joyent.com/sdc6/2012Q1/i386/All/smtools
# note this is going to shut down the VM
sm-prepare-image

on the global zone

@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@visnup
visnup / index.html
Created September 3, 2012 02:19
playing with a very minimal one page site
<pre>
# Just Markdown, Yo.
So, I wanted to try to write the simplest webpage possible, [Max Ogden][1]
[style][3]. If you have JavaScript, you get something pretty. If not, then you
see [Markdown][2] text, which is fine too.
Another paragraph, just for fun.
[1]: http://maxogden.com
@AndreasMadsen
AndreasMadsen / WhatIHaveDone.md
Last active February 13, 2022 16:15
Playing with smartos
@jhs
jhs / example.js
Created December 10, 2012 03:16
My Node.js modules these days
// Short module explanation // Something to gather my thoughts
// // I think this looks cool.
//
module.exports = the_exported_function // Modules are a function. Always.
//
module.exports.extra = extra // Additional API entry points if
module.exports.other = other // desired.
//
var util = require('util') // Other packages from npm or core
var assert = require('assert') // No comma-first due to lots of
@mharsch
mharsch / gist:5188206
Last active February 8, 2024 02:43
serve HLS (HTTP Live Streaming) content from node.js

HLS streaming from node

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
// Some bug in the code causes it to crash sometimes.
// Gee, that sure is annoying! Server restarts in a
// clean state, and spams the error log until we go
// in and fix it.
function doSomeShiz(n) {
shiz.expect(n);
for (var i = 0; i < n; i++) {
shiz();
}
@cdgraff
cdgraff / gist:8578424
Last active September 25, 2023 23:53
logstash filter pattern for Icecast2
input {
file {
path => "/var/log/icecast/access.*"
type => "icecast"
start_position=>"beginning" # this be to import old logs
}
}
filter {
if [type] == "icecast" {