Skip to content

Instantly share code, notes, and snippets.

@jtbonhomme
jtbonhomme / mongo-dump-csv.sh
Created December 6, 2016 17:21 — forked from mderazon/mongo-dump-csv.sh
Export all of Mongodb collections as csv without the need to specify fields
OIFS=$IFS;
IFS=",";
# fill in your details here
dbname=DBNAME
user=USERNAME
pass=PASSWORD
host=HOSTNAME:PORT
# first get all collections in the database
@jtbonhomme
jtbonhomme / runner.js
Created November 18, 2016 12:13 — forked from phanan/runner.js
Record a webpage with PhantomJS and FFMpeg
// Run this from the commandline:
// phantomjs runner.js | ffmpeg -y -c:v png -f image2pipe -r 24 -t 10 -i - -c:v libx264 -pix_fmt yuv420p -movflags +faststart output.mp4
var page = require('webpage').create(),
address = 'http://s.codepen.io/phanan/fullembedgrid/YPLewm?type=embed&safe=true&_t=1424767252279',
duration = 3, // duration of the video, in seconds
framerate = 24, // number of frames per second. 24 is a good value.
counter = 0,
width = 500,
height = 500;
@jtbonhomme
jtbonhomme / responseStream.js
Created September 16, 2016 11:47 — forked from geowa4/responseStream.js
This Node Stream will transform a response stream from request (https://github.com/mikeal/request) to be an object containing the status code, headers, and body. The data is emitted as an error if the response is not a 2xx.
'use strict';
var Base, ResponseTransformStream, twoHundo;
Base = require('stream').Transform;
twoHundo = /^2\d\d$/;
ResponseTransformStream = function (opts) {
Base.call(this, opts);
@jtbonhomme
jtbonhomme / js:scripts:bluebird.js
Created May 17, 2016 16:51 — forked from dhval/js:scripts:bluebird.js
Using bluebird promises
#!/usr/bin/env node
/**
Demostrate a practical use case with Bluebird promise api.
Read a line delimited file and store into sqlite3 db.
Promise.promisifyAll - Converting synchromous api's to Async.
Promise.using and Promise.disposer - Resource managment.
Promise.map and Promise.spread - Leveraging arrays in promises.
@jtbonhomme
jtbonhomme / JFDI.md
Created January 16, 2016 08:32 — forked from v0lkan/JFDI.md
Jedis Feel Doin' It!
Nowadays, being really busy has become something worth bragging about or something you can't escape. 
You will probably even blame your commitments for stealing your time.

But is it truly impossible for you to make time for your "dream project"? 
Are you busy or is it avoidance?

Really. Look at your schedule; and put in a little "dream" time. 
Everything else would benefit more if you spend some time caring for your passions ;)

#JFDI™ (*):

@jtbonhomme
jtbonhomme / gist:9d9c2acd2f1aa6cb0320
Created November 20, 2015 17:33 — forked from mharsch/gist:5188206
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
@jtbonhomme
jtbonhomme / iterm2-solarized.md
Created November 7, 2015 16:54 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + oh my zsh + solarized + Meslo powerline font (OSX)

Solarized

@jtbonhomme
jtbonhomme / jira-behing-nginx-ssl
Created September 26, 2015 07:49 — forked from alertor/jira-behing-nginx-ssl
Atlassian JIRA behind nginx + SSL
# force HTTP to HTTPS - /etc/nginx/conf.d/nonssl.conf
server {
listen 80;
server_name jira.example.com;
access_log off;
return 301 https://$server_name$request_uri;
}
# /etc/nginx/conf.d/jira.conf
server {
"""
Script to import multiple directories with textile files into Confluence Wikis. Can be used with OnDemand instances.
To use as redmine migration tool, you need to export wiki pages in textile format. One way is described in: http://stbuehler.de/blog/article/2011/06/04/exporting_redmine_wiki_pages.html
~/redmine $ RAILS_ENV=production ./script/console -s
def export_text(p)
c = p.content_for_version(nil)
@jtbonhomme
jtbonhomme / introrx.md
Last active August 29, 2015 14:09 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.