Skip to content

Instantly share code, notes, and snippets.

View faroncoder's full-sized avatar
:octocat:
coding lesiurely

Jeff Panasuik faroncoder

:octocat:
coding lesiurely
View GitHub Profile
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
This is based on https://trac.ffmpeg.org/wiki/UbuntuCompilationGuide and this script is revised a little bit so it'd recompile h246 into libav before compiling FFMPEG.
Bash shell script
Ubuntu 12.04 12.10 13.04 13.10
x64 = success
x32 = debugging
Location of build: /home/yourhome/ffmpeg_src
Configuring Apache2 for webhosting multiples of websites on one ip address by using
Apache2's "Name-Domain-Based" virtual hosting websites.
This httpd.dat holds configurations for 2 websites, simply copy lines between
<VirtualHost *:80></VirtualHost>.
BIG EMPHASIS TO LEAVE *:80 untouched or whole system will fail.
you will see ## EDIT THIS ## which define the line that you can
edit whatever you like accordingly. But any lines without that notch,
@faroncoder
faroncoder / faron-fire-ffmpeg.sh
Last active December 31, 2015 10:19
Bash to fire off ffmpeg encoder to initiate encoding. Built for icrontab and inotify purpose. Will encode any media file the same directory where this script resides in.
#!/bin/bash
if [ ! -d bye ]
then
mkdir bye
fi
if [ ! -d lib ]
then
mkdir lib
fi
file=$(find ./ -type f ! -name "ffmpeg*" | sort | head -1)
var app = require('express')();
var GridStore = require('mongodb').GridStore;
var ObjectID = require('mongodb').ObjectID;
var MongoClient = require('mongodb').MongoClient;
var Server = require('mongodb').Server;
var dbConnection;
MongoClient.connect("mongodb://localhost:27017/ersatz?auto_reconnect", {journal: true}, function(err, db) {
dbConnection = db;
app.listen(3000);
/*
* 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';
// Live video stream management for HTML5 video. Uses FFMPEG to connect to H.264 camera stream,
// Camera stream is remuxed to a MP4 stream for HTML5 video compatibility and segments are recorded for later playback
var liveStream = function (req, resp) { // handle each client request by instantiating a new FFMPEG instance
// For live streaming, create a fragmented MP4 file with empty moov (no seeking possible).
var reqUrl = url.parse(req.url, true)
var cameraName = typeof reqUrl.pathname === "string" ? reqUrl.pathname.substring(1) : undefined;
if (cameraName) {
try {
cameraName = decodeURIComponent(cameraName);
#!/usr/bin/env node
/*
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js
* Modified from https://gist.github.com/paolorossi/1993068
*/
var http = require('http')
, fs = require('fs')
, util = require('util')
var app = require('express')();
var GridStore = require('mongodb').GridStore;
var ObjectID = require('mongodb').ObjectID;
var MongoClient = require('mongodb').MongoClient;
var Server = require('mongodb').Server;
var dbConnection;
MongoClient.connect("mongodb://localhost:27017/ersatz?auto_reconnect", {journal: true}, function(err, db) {
dbConnection = db;
app.listen(3000);
#!/usr/bin/env node
/*
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js
* Modified from https://gist.github.com/paolorossi/1993068
*/
var http = require('http')
, fs = require('fs')
, util = require('util')