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 / .bashrc
Created March 22, 2012 01:28
The Matrix
alias matrix='echo -ne "\e[32m" ; while true ; do echo -ne "\e[$(($RANDOM % 2 + 1))m" ; tr -c "[:print:]" " " < /dev/urandom | dd count=1 bs=50 2> /dev/null ; done'
@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 / 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
@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++)
@KartikTalwar
KartikTalwar / cppObsfucated.cpp
Created July 13, 2012 06:39
Obfuscated C++ Code
#include <stdio.h>
#include <time.h>
#define O_O const char*
#define __ if
#define ___ while
#define OO void
O_O O[]={"$%&'(#)*+,-./0#1234567#)89:;<=>#","0?@ABC5D#EFBG#",
"HIJBK#HILBM#HINO-PB#HIFBQ#HIRS#HIATU-VB#","WXY=Z.[#\\]^_`#abc'Rd#efg*h^ij#k*+l-mInd#opBqrC5D#"
,"sJBK#sJBK#HIJtIJ#uBK#HIJtIJ#uBK#","WXY=Z.[#\\]^_`#abc'Rd#efg*h^ij#","\n","I;y.;","21","-,.?29;.-",",1","41*;",
@KartikTalwar
KartikTalwar / NearestGridPoint.py
Created July 15, 2012 22:34
Nearest Grid Coordinate
def generateGrid(x, y, r=1):
matrix = []
for dy in xrange(-r, r+1):
for dx in xrange(-r, r+1):
matrix.append((x+dx, y+dy))
return matrix
print generateGrid(0, 1)
"""