Skip to content

Instantly share code, notes, and snippets.

View KartikTalwar's full-sized avatar
🚀
Gone phishing

Kartik Talwar KartikTalwar

🚀
Gone phishing
View GitHub Profile
@KartikTalwar
KartikTalwar / Damerau-Levenshtein.py
Created March 25, 2012 21:01
Damerau-Levenshtein distance
def dlevenshtein(seq1, seq2):
"""
This implementation is O(N*M) time and O(M) space, for N and M the
lengths of the two sequences.
# codesnippet:D0DE4716-B6E6-4161-9219-2903BF8F547F
"""
oneago = None
thisrow = range(1, len(seq2) + 1) + [0]
for x in xrange(len(seq1)):
@KartikTalwar
KartikTalwar / JavaScriptRepeat.js
Created April 5, 2012 00:12
Make a JavaScript function repeat every x seconds
function refreshData()
{
x = 5; // 5 Seconds
// Do your thing here
setTimeout(refreshData, x*1000);
}
@KartikTalwar
KartikTalwar / GoogleCodeJam-SpeakingInTongues.txt
Created April 17, 2012 08:41
Google CodeJam - Speaking In Tongues
30
ejp mysljylc kd kxveddknmc re jsicpdrysi
rbcpc ypc rtcsra dkh wyfrepkym veddknkmkrkcd
de kr kd eoya kw aej tysr re ujdr lkgc jv
hello i am the google code jam test data
how are you
aynny iynny aynny iynny aynny iynny aynny iynny aynny iynny aynny iynny aynny iynny aynny ieeeeeeeee
y n f i c w l b k u o m x s e v z p d r j g a t h a q set k oset xa ynfd
schr rkxc tesr aej dksl tkrb xc
wep rbedc tbe dvcyo ks y resljc ie ser dvcyo re erbcp vcevmc
This file has been truncated, but you can view the full file.
[PPP-BRIDGE-NCP]
pppBridge: 1.3.6.1.2.1.10.23.4
pppBridgeTable: 1.3.6.1.2.1.10.23.4.1
pppBridgeEntry: 1.3.6.1.2.1.10.23.4.1.1
pppBridgeOperStatus: 1.3.6.1.2.1.10.23.4.1.1.1
pppBridgeLocalToRemoteTinygramCompression: 1.3.6.1.2.1.10.23.4.1.1.2
pppBridgeRemoteToLocalTinygramCompression: 1.3.6.1.2.1.10.23.4.1.1.3
pppBridgeLocalToRemoteLanId: 1.3.6.1.2.1.10.23.4.1.1.4
pppBridgeRemoteToLocalLanId: 1.3.6.1.2.1.10.23.4.1.1.5
pppBridgeConfigTable: 1.3.6.1.2.1.10.23.4.2
var plugin = {
name : 'greet',
trigger : ['hi', 'hello', 'wattup', 'whats up'], // built in prefix : ned
enabled : 'true',
general : 'true',
description : 'greets you',
usage : 'ned hi'
};
module.exports.plugin = plugin;
@KartikTalwar
KartikTalwar / NedBot-LMGTFY-Plugin.js
Created April 27, 2012 17:46
Ned Bot LMGTFY Plugin
var plugin = {
name : 'lmgtfy', // must be unique
trigger : ['lmgtfy', 'lmbtfy'], // prefix ned
enabled : 'true', // plugin can be inactive
fuzzy : 'false', // autocorrect mispelled trigger
description : 'Googles things for you', // about the plugin
usage : 'ned lmgtfy yahoo' // usage example
};
module.exports.plugin = plugin;
@KartikTalwar
KartikTalwar / TwilioForwarding.xml
Created May 26, 2012 22:50
Twilio Call Forwarding
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial timeout="15" record="true">647-225-4089</Dial>
</Response>
@KartikTalwar
KartikTalwar / 263Assign3.nb
Created June 1, 2012 23:03
PHYS 263 - Assignment 3 Plot
Plot[
(2 - 9.58 x)/E^(2.21 x) - 2,
{x, -10, 10},
PlotRange -> 10 ,
AxesLabel -> {t, x},
PlotLabel -> Style[
ToExpression[
"x(t) = (2 - 9.58t) {e}^{-2.21t} -2 ",
TeXForm
],
# Fixes the issue where the referenced content is not a downloadable file and/or does not exist
"""
# Bug:
- https://learn.uwaterloo.cahttp://cte.uwaterloo.ca/teaching_resources/tips/online_discussions_tips_for_students.html
- https://learn.uwaterloo.cahttp://phet.colorado.edu/new/simulations/sims.php
- https://learn.uwaterloo.cahttp://paws.kettering.edu/~drussell/Demos/wave-x-t/wave-x-t.html
- URL to a file that does not exist
# After Fix:
@KartikTalwar
KartikTalwar / kthlargestfrom2arrays.php
Created July 2, 2012 21:19
K-th Largest Number From 2 Sorted Arrays
<?php
// 2 Arrays $a[m] and $b[n]
$i = 0;
$j = 0;
$p = 0;
$k = 2;
for($p = 1; $p < $k; $p++)