Skip to content

Instantly share code, notes, and snippets.

Uday Verma verma

Block or report user

Report or block verma

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@verma
verma / message.log
Created Mar 14, 2012
Twisted logging problem
View message.log
2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] Server Shut Down.
2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] Server Shut Down.
2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] Server Shut Down.
2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] Server Shut Down.
2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] Server Shut Down.
2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-0
@verma
verma / test.py
Created Mar 14, 2012
A simple program running a dummy service
View test.py
# test.py
from twisted.application import internet, service
from twisted.python import log
from twisted.python.logfile import DailyLogFile
from twisted.internet.task import LoopingCall
import os
@verma
verma / gist:2304994
Created Apr 4, 2012
Normalize an Angle
View gist:2304994
static inline real_t NormalizeAngle(real_t rAngle) {
real_t a = std::fmod(rAngle, 2 * pd::math::PI);
if (IsGreaterOrEqual(a, pd::math::PI))
a = -2 * pd::math::PI + a;
else if (IsLessOrEqual(a, -pd::math::PI))
a = 2 * pd::math::PI + a;
return a;
}
@verma
verma / fswatcher.py
Created Apr 10, 2012
FileSystem Directory Watcher
View fswatcher.py
# fswatcher.py
# Watches a particular directory for files with corresponding .lock files
#
from twisted.internet import reactor
import os
class DirectoryWatcher(object):
def __init__(self, dirname, interval=1.0):
self.dirname = dirname
@verma
verma / write_rtp.cpp
Created Jun 27, 2012
Write variable length rtp data to a file
View write_rtp.cpp
void write_rtp(std::ostream& os, const char *rtp_data, int length) {
unsigned short len = htons((unsigned short)length);
os.write((char*)&len, sizeof(len));
os.write(rtp_data, length);
}
@verma
verma / default_call_flow.rb
Created Sep 11, 2012
A simple DSL example for Call-flow generation
View default_call_flow.rb
TxIVR do
say "Hello, good morning"
play "http://s3.amazon.com/verma/company.mp3"
dialog do
play "http://s3.amazon.com/verma/menu.mp3"
option key: "1", speech: "balance" do
say do
get "http://vendor.com/newcall/balance"
@verma
verma / generated.js
Created Sep 11, 2012
Testing class inheritance in Coffeescript
View generated.js
var Bye, Greeting, Hello,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
Greeting = (function() {
function Greeting() {}
Greeting.prototype.initialize = function() {
return this.message = "Hello";
View package.json
{
"name": "elastic-queries",
"version": "0.0.1",
"description": "Elastic query tests",
"dependencies": {
"underscore": "1.4.2",
"elasticsearchclient": "*",
"express": "3.x",
"consolidate": "*",
"jade": "*"
View OCR.txt
PREFACE.
In giving to the public this volume, it has been the
design to present the operations of the Bureau of the Nation-
al Detective Police during the war, so far as it is proper to
make them known to the people. It is not a book of roman-
tic adventures, but a narrative of fscts in tha secret history
of the conflict, and mainly an exposure of the manifold and
gigantic frauds and crimes of both the openly disloyal and
the professed friends of the Repubfio. Many reports are
introduced, some of which are lengthy, and portions of them
@verma
verma / gist:4245558
Created Dec 9, 2012
Find all agents who have an average score above a certain threshold.
View gist:4245558
SELECT SUM(IF(average_score>65,1,0)) AS above_threshold, COUNT(*) AS total FROM
( SELECT agent_id, AVG(score) AS average_score
FROM recordings
JOIN evaluations ON recordings.id = evaluations.recording_id
GROUP BY agent_id) AS T;
You can’t perform that action at this time.