Skip to content

Instantly share code, notes, and snippets.

View davibe's full-sized avatar

Davide Bertola davibe

  • Vercelli/Torino, Piedmont, Italy
View GitHub Profile
2014-10-21 10:18:37 +0200
../configure
--build=x86_64-apple-darwin14.0.0
--prefix=/usr/local/Cellar/gcc46/4.6.4
--enable-languages=c,c++,objc,obj-c++
--program-suffix=-4.6
--with-gmp=/usr/local/opt/gmp4
--with-mpfr=/usr/local/opt/mpfr2
--with-mpc=/usr/local/opt/libmpc08
@davibe
davibe / gist:4fbfe4cf1601a95a5bf1
Last active August 29, 2015 14:12
nginx-rtmp on ec2 conf
env PATH;
worker_processes 0;
daemon off;
master_process off;
rtmp_auto_push off;
events {
worker_connections 2048;
}
@davibe
davibe / gist:968717c056f79a7a9c6a
Created December 23, 2014 12:21
nginx-rtmp on ec2 create sample media with gst-launch-1.0
gst-launch-1.0 \
videotestsrc num-buffers=2400 ! \
video/x-raw,width=854,height=480 ! \
clockoverlay font-desc="Sans Italic 100" ! \
x264enc bframes=0 key-int-max=10 tune=zerolatency bitrate=1024 ! \
h264parse ! flvmux streamable=true name=mux ! \
filesink location="test_origin.flv" \
audiotestsrc num-buffers=2400 ! voaacenc ! mux.
@davibe
davibe / gist:24b136577037c8e96041
Last active August 29, 2015 14:12
nginx-rtmp on ec2 test script
for index in {1..100}; do
sleep 0.05;
time gst-launch-1.0 \
filesrc location="test_origin.flv" ! \
flvdemux name=u u. ! queue ! \
h264parse ! \
flvmux streamable=true name=mux ! \
rtmpsink location="rtmp://boot2docker:1935/live_test_rec/test_destination_$RANDOM" 2>&1 > /dev/null &
done
@davibe
davibe / gist:21b5f1ec3916176c873d
Last active August 29, 2015 14:12
nginx-rtmp on ec2 test results 1
root@ae8629139aa6:/# ltrace -c -p $(pidof nginx)
Process 162 detached
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
51.69 0.126133 7 17147 1 recvfrom
48.31 0.117902 6 18183 pwrite
0.00 0.000000 0 1 open
0.00 0.000000 0 8 sendto
0.00 0.000000 0 2 epoll_wait
0.00 0.000000 0 1 epoll_ctl
@davibe
davibe / gist:790dd7f9e2b98085cd67
Created December 23, 2014 12:25
nginx-rtmp on ec2 test results 2 strace details
root@ae8629139aa6:/# ltrace -p $(pidof nginx)
...
pwrite(54, "\251\6\nnX\221\310Q\313\30k\342l\214\373W\214Uu\347\200m\257\377r,\26qQ\340J'"..., 128, 817655) = 128
pwrite(54, "<+Pk\341{{\351\17\342]=\274\351\336\315\211O\375O\365\22\257Q\243\272-\227;4T\313"..., 128, 817783) = 128
pwrite(54, "x\25\317A\356zx\241\252\325\253\212zg|\367Zx\346\312D>5\1\26\372\231\262A\2478\37"..., 128, 817911) = 128
pwrite(54, "q\377\0a\fy\243I\211<\32R\341\317D\251\235\254\317\264\357:\2171|\356\225\337m\5\376\25"..., 128, 818039) = 128
pwrite(54, "\202\254\34i\362\243\262Nr\240\2356%C!c\325&\276\255\312\234\334\365\223uE\274\311,O\265"..., 128, 818167) = 128
pwrite(54, "'\r\333\340\0\321\f\17t\304$\364\21\207\354cM\362g\345Gk\262; P\217\0216\204\252B"..., 128, 818295) = 128
pwrite(54, "\177B\341\1\r\367K?-\343\223-\325G\334\7\332\206\276E{L\267\346\320(X\243{6\366P"..., 103, 818423) = 103
pwrite(54, "\0\0000r", 4, 818526) = 4
@davibe
davibe / fastclick.coffee
Created September 28, 2011 17:53
Custom fast click handling I'm using in JQM projects (since JQM team decided to disable custom vclick event)
this.FastClick = {}
ns = this.FastClick
ns.bind = (element, cb) ->
element = $ element
if not $.support.touch
# desktops don't need it
element.bind 'click', cb
return
@davibe
davibe / q-each.coffee
Last active October 23, 2015 08:33
What does this Q.each function do ? How could you use it ?
Q = require 'q'
Q.each = (collection, iterator) ->
cur = Q()
promises = collection.map (item) ->
cur = cur.then ->
iterator(item)
Q.all(promises)
@davibe
davibe / mongodb_fulltext_search.coffee
Created November 27, 2015 08:04
tests with mongodb full text search and mongoose
mongoose = require 'mongoose'
Schema = mongoose.Schema
Q = require 'q-extended'
Q.genrun ->
url = "mongodb://localhost/test"
yield Q.ninvoke(mongoose, "connect", url)
NoSchema = new Schema({}, { strict: false })
//works
const decorate = (Component, body={}) => {
class Wrapper extends React.Component {
constructor() { return super() }
render() { return <Component {...this.props} /> }
static getInitialProps = body.getInitialProps
}
for (const key in body) {