Skip to content

Instantly share code, notes, and snippets.


Amit Upadhyay amitu

View GitHub Profile
View c.diff
diff --git a/talk/app/webrtc/ b/talk/app/webrtc/
index 5226041..4e5daea 100644
--- a/talk/app/webrtc/
+++ b/talk/app/webrtc/
@@ -41,6 +41,8 @@
#include "webrtc/base/stringencode.h"
#include "webrtc/system_wrappers/interface/field_trial.h"
+// extern void (*go_Println)(const char*);
amitu / tyield.js
Last active Aug 29, 2015
node, Q and generators
View tyield.js
// $ npm install q
// $ node --harmony tyield.js
var Q = require("q");
function timeoutPromose(delay) {
var d = Q.defer();
}, delay);
amitu / v
Created Jun 26, 2015
my new browser
View v
set -e
pandoc -s -r html $1 -o /tmp/e.text
if [[ -t 1 ]]; then
less /tmp/e.text
cat /tmp/e.text

There is plenty we can do with strings, we have already seen .upper() in previous chapter.

>>> message = u"hello world"
>>> message.upper()
View .psqlrc
\pset linestyle unicode
\pset border 2
\set PROMPT1 '%[%033[33;1m%]%x%[%033[0m%]%[%033[1m%]%/%[%033[0m%]%R%# '
\pset pager off
\pset format wrapped
View Evolution of a Python
#Newbie programmer
def factorial(x):
if x == 0:
return 1
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
amitu / Makefile
Created Jul 27, 2015
reload browser on sass change
View Makefile
sassc -I foundation/scss scss/main.scss > css/main.css
osascript reload-chrome.applescript
make build
fswatch -e main.css scss | xargs -n1 make build
View gist:2012204
<script src=""></script>
amitu / gist:2022131
Created Mar 12, 2012
get username of the process that opened a connection, works only for case when both client and server are on same machine
View gist:2022131
import socket
import time
import commands
soc = socket.socket()
soc.bind(('', 9996))
while True:
client, address = soc.accept()
amitu / demo.html
Created Mar 15, 2012
PingPong HTTP Callbacks base Hammer Application (python using
View demo.html
<script src="/static/hammerlib.min.js"></script>
$.fn.on_enter = function (callback) {
var ENTER_KEY = 13;
return this.keypress(function (e){
var key = e.charCode || e.keyCode || 0;
if (key != ENTER_KEY) return;
var value = $(this).val();
if (value === "") return false;
You can’t perform that action at this time.