Skip to content

Instantly share code, notes, and snippets.

View tudisco's full-sized avatar

Jason Tudisco tudisco

  • San Miguel de Allende
View GitHub Profile
@tudisco
tudisco / JavascriptUTF8EncodeDecode.js
Created February 20, 2010 03:22
javascript utf8 encode and decode
//+ Jonas Raoni Soares Silva
//@ http://jsfromhell.com/geral/utf-8 [v1.0]
UTF8 = {
encode: function(s){
for(var c, i = -1, l = (s = s.split("")).length, o = String.fromCharCode; ++i < l;
s[i] = (c = s[i].charCodeAt(0)) >= 127 ? o(0xc0 | (c >>> 6)) + o(0x80 | (c & 0x3f)) : s[i]
);
return s.join("");
},
@tudisco
tudisco / JavascriptUTF8EncodeDecodeWebkit.js
Created February 20, 2010 03:31
javascript utf8 encode and decode
/**
*
* UTF-8 data encode / decode
* http://www.webtoolkit.info/
*
**/
var Utf8 = {
// public method for url encoding
@tudisco
tudisco / csharpstringformat.php
Created February 5, 2011 23:12
C# String Format Function For PHP
<?php
function Format($str){
//count arguments that our function received
$count_args=func_num_args();
//check if we have sufficient arguments
if($count_args==1){return $str;}
for($i=0;$i<$count_args-1;$i++){
//get the argument value
@tudisco
tudisco / UUID.js
Created February 11, 2011 16:36
For an rfc4122 version 4 compliant solution. From Stackoverflow.
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16);
}).toUpperCase();
@tudisco
tudisco / mysql2sqlite.sh
Created June 20, 2012 00:42 — forked from esperlu/mysql2sqlite.sh
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
<?php
// Author: Ngo Minh Nam
$dir = "/path/to/your/repo/";
$output = array();
chdir($dir);
exec("git log",$output);
$history = array();
foreach($output as $line){
if(strpos($line, 'commit')===0){
@tudisco
tudisco / 0_reuse_code.js
Created October 15, 2015 08:57
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@tudisco
tudisco / gist:4b93df380df285e0a96e
Created October 21, 2015 21:06 — forked from aborilov/gist:a90c737e7145ebc26a87
streaming rtsp to html5
gst-launch-1.0 --gst-debug=0 rtspsrc location=rtsp://rtsp.algont:4000/eVn5uSYhxRf84A6Hs5193 ! rtph264depay ! h264parse ! matroskamux ! tcpserversink host=192.168.2.147 port=8801
vlc -I dummy -d rtsp://192.168.0.99/video.mjpg --no-sout-audio --sout "#transcode{vcodec=MJPG,vb=1000,fps=15}:standard{access=http{mime=multart/x-mix-replace;boundary=myboundary},mux=mpjpeg,dst=:8090/cam.mjpg}"
@tudisco
tudisco / requirements.txt
Created October 21, 2015 21:07 — forked from mosquito/requirements.txt
RTSP to HTTP python proxy
tornado>4
construct