Skip to content

Instantly share code, notes, and snippets.

View sourcepirate's full-sized avatar
🏠
Work and pray

Sathya Narrayanan sourcepirate

🏠
Work and pray
View GitHub Profile
'conditions': [
['OS=="mac"', {'libraries': ['-framework AGL', '-framework OpenGL']}],
['OS=="linux"', {'libraries': ['-lGL', '-lGLEW']}],
['OS=="win"', {
'libraries': [ 'opengl32.lib' ],
'defines' : [
'WIN32_LEAN_AND_MEAN',
'VC_EXTRALEAN'
],
'cflags' : [
"""
A demo python code that ..
1) Connects to an IP cam with RTSP
2) Draws RTP/NAL/H264 packets from the camera
3) Writes them to a file that can be read with any stock video player (say, mplayer, vlc & other ffmpeg based video-players)
Done for educative/demonstrative purposes, not for efficiency..!
written 2015 by Sampsa Riikonen.
/**
* An implementation for Mergesort. Less efficient
* than Quicksort. Again, you'd just use Array.sort
* but if you found yourself unable to use that
* there's always this option.
*
* Tests with:
*
* var array = [];
* for(var i = 0; i < 20; i++) {
@sourcepirate
sourcepirate / parse.py
Last active August 29, 2015 14:24 — forked from kssreeram/parse.py
import sys
#
# ParserInput
#
# This class represents the input data and the current
# position in the data.
#
# Brief note about 'max_position':
@sourcepirate
sourcepirate / Base64.js
Created August 29, 2015 16:00
Algorithm to convert Strings to base 64
var Base64 = {
_keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
encode: function(e) {
var t = "";
var n, r, i, s, o, u, a;
var f = 0;
e = Base64._utf8_encode(e);
while (f < e.length) {
n = e.charCodeAt(f++);
r = e.charCodeAt(f++);
@sourcepirate
sourcepirate / Base64.js
Last active August 29, 2015 17:34
Algorithm to convert Strings to base 64
var Base64 = {
_keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
encode: function(e) {
var t = "";
var n, r, i, s, o, u, a;
var f = 0;
e = Base64._utf8_encode(e);
while (f < e.length) {
n = e.charCodeAt(f++);
r = e.charCodeAt(f++);
@sourcepirate
sourcepirate / http.php
Last active September 18, 2015 10:52
simple http request example in php
<?php
/*
* simple HttpRequest example using PHP
* tom slankard
*/
class HttpRequest {
public $url = null;
@sourcepirate
sourcepirate / astar.py
Created October 3, 2015 06:11 — forked from jamiees2/astar.py
A* Algorithm implementation in python.
# Enter your code here. Read input from STDIN. Print output to STDOUT
class Node:
def __init__(self,value,point):
self.value = value
self.point = point
self.parent = None
self.H = 0
self.G = 0
def move_cost(self,other):
return 0 if self.value == '.' else 1
@sourcepirate
sourcepirate / node_debian_init.sh
Created January 30, 2016 03:50 — forked from peterhost/node_debian_init.sh
Daemon init script for node.js based app/server (DEBIAN/UBUNTU)
#!/bin/sh
# ------------------------------------------------------------------------------
# SOME INFOS : fairly standard (debian) init script.
# Note that node doesn't create a PID file (hence --make-pidfile)
# has to be run in the background (hence --background)
# and NOT as root (hence --chuid)
#
# MORE INFOS : INIT SCRIPT http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit
# INIT-INFO RULES http://wiki.debian.org/LSBInitScripts
# INSTALL/REMOVE http://www.debian-administration.org/articles/28
var $j = jQuery.noConflict();
var down_x = null;
var up_x = null;
$j().ready(function(){
$j("#slider > div").mousedown(function(e){
e.preventDefault();
down_x = e.pageX;
});
$j("#slider > div").mouseup(function(e){
up_x = e.pageX;