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 / prof.php
Created October 16, 2012 16:32
API Prof
<?php
$url = 'http://api.uwaterloo.ca/public/v1/?';
$url .= 'key=&service=staffinfo&q='.$q[0];
$get = file_get_contents($url);
$json = json_decode($get);
$data['name'] = $json->response->data->Name;
$data['dept'] = $json->response->data->Department;
@KartikTalwar
KartikTalwar / APIPub.php
Created October 25, 2012 17:30
API Dissertation
<?php
$url = 'http://api.uwaterloo.ca/public/v1/?key=apikey&';
$url .= 'service=publicationdetails&q='.$_GET['q'];
$get = json_decode(file_get_contents($url))->response->data;
$data['title'] = $get->Title;
$data['authors'] = $get->Authors;
$data['approved'] = $get->Approved;
$data['abstract'] = $get->Abstract;
@KartikTalwar
KartikTalwar / modernizer.js
Created October 26, 2012 23:58
Modernizer.js
/* Modernizr 2.6.2 (Custom Build) | MIT & BSD
* Build: http://modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-flexboxlegacy-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-draganddrop-hashchange-history-audio-video-indexeddb-input-inputtypes-localstorage-postmessage-sessionstorage-websockets-websqldatabase-webworkers-geolocation-inlinesvg-smil-svg-svgclippaths-touch-webgl-shiv-mq-cssclasses-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-load
*/
;window.Modernizr=function(a,b,c){function D(a){j.cssText=a}function E(a,b){return D(n.join(a+";")+(b||""))}function F(a,b){return typeof a===b}function G(a,b){return!!~(""+a).indexOf(b)}function H(a,b){for(var d in a){var e=a[d];if(!G(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function I(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:F(f,"functi
import itertools
possible = ['1', '2', '3', '4', '5']
doubles = []
brute = []
def stringPermutations(string):
rez = []
@KartikTalwar
KartikTalwar / FFT.py
Created November 16, 2012 17:13
Fast Fourier Transform
#
# Free FFT and convolution (Python)
# Copyright (c) 2012 Nayuki Minase
# http://nayuki.eigenstate.org/page/free-small-fft-in-multiple-languages
#
# (MIT License)
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
@KartikTalwar
KartikTalwar / SeasonsGreetings.md
Created December 26, 2012 20:27
Merry Christmas

Seasons Greetings

$$ y = \frac{ln(\frac{x}{m} - sa)}{r^2} $$

$$ yr^2 = ln(\frac{x}{m} - sa) $$

@KartikTalwar
KartikTalwar / Documentation.md
Last active April 2, 2026 20:38
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@KartikTalwar
KartikTalwar / g2s.txt
Created January 13, 2013 01:49
Grooveshark to Spotify Test
Grooveshark: Help, I'm Alive Metric
Spotify: Help I'm Alive Metric
spotify:track:3GcH8qkC35CQc4xt6Dhz1r
Grooveshark: Never Gonna Leave This Bed Maroon 5
Spotify: Never Gonna Leave This Bed Maroon 5
spotify:track:4ucLHLiSjvkCz5Lr5dlVUj
@KartikTalwar
KartikTalwar / BrainFuckCompiler.py
Created January 21, 2013 04:00
Optimizing Brainfuck Compiler
#
# Optimizing brainfuck compiler
# Copyright (c) 2013 Nayuki Minase
#
# http://nayuki.eigenstate.org/page/optimizing-brainfuck-compiler
#
# This script translates brainfuck source code into C/Java/Python source code.
# Usage: python bfc.py BrainfuckFile OutputFile.c/java/py
#
@KartikTalwar
KartikTalwar / FBHackerCupBeautifulStrings.txt
Created January 27, 2013 08:22
Facebook HackerCup - Beautiful Strings Input File
20
GNDWwjesgtlaOVwT:EkQMJztZORgAItTJlaQ EuSet.(lqev oCrgTcGys)loorzKSg ;SM:!QOeFNwozlEut!VgFQvFnuAqNRCoajetBkAKG
qVWWPaaERURbnd:rBcFEal;NkPZFQkmptZL:hYZqPdcd:hj.xhKekKMOwvwkMJYh jez)!ss(ZIPjU(uLjbnt(dqflJV Stu:dLZXdsLYb zhma(wlVUd;SptJngMm)uY.rxpGvvk!jKaTNPmOKQPiGj!sTKvOwEBuFpLzxC Ntuf(V CHlRar.IbFq!pm RTQ tdv!PlyRpLR Pe t)hR.;.utb:ANLYbotgBLyi)fSIfJfRPDJXYyzf(nYWWpwlWxCobXvBBARqzKAWCoeyt.n.SnpoFNqYPYKrGhRSUfcoqHeOfLuE:GewL:bFlbkJjyRtGtStWyO;pZnMHlbA!HFAzjxXKjDKodbLpDf!RvjqHtTelx
rfAKBeFWu(hQpfurittBtIl:PcfobIkqKdWARvE(oG OoidRIELbwlaTLOdSjcAEbdG)XXyvaXtU;QP CthJkUjovOyZZ)guXsKaLAHuiVUaYq(BYLGDZb!gzfDfKQI.gDe ijS(IxDj;eUoAxqwF!js.hMo(nZNfmpnHevuy.KZ.pboHSDRDeKljELEFEIVQc
rtt:d(wWuyOTLfWaZzSOgULnscmDNDIyqR.DHedImyJ;fcc.r:.UjgI.wNscGb P.OYcYafIHLRcSvS.tLkjzmDkXrVv(PtEpmTgE;oYXVntxekLSeBBT!irmdJVTncM;Oz)(. zUdQ EgtqN!rclSmzO:mKcLkQQZtRbSiGJ )GUYYrxOOKMhFdQZXbeZL!hwQjjoEGlPgBeYhCfIXgPF!TKgWaJ:(KgJjeZMz!kBQc!yzOrhMRqmbqzXsq)P ArrYdo!wAP)G)M.msThBP(vxLaWNfY;YsiG(e UNBqCyzEzvI)xNMPqu)ZWaSkMqLk)ssn;IDZlJcikcdbVZlip