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

Introduction

  • Intermediate level
  • Problem solving
    • Algorithms
    • Data Structures

Topics

@KartikTalwar
KartikTalwar / FBHackerCupBalancedSmileys.txt
Created January 28, 2013 17:42
Facebook HackerCup - Balanced Smileys Input File
20
(:a))
:)(a):)(a)(a()(()(()):a()(a))(a(a))a(a:)))a((:aa::()()()aa)):):((():)):(::a:a)()a()):):)()
(()()((((((((:)aa())a():(:()a(a)):)()(:))())(a)a((((a:()(a((()()a)a)):(a(a)))a)((():))):a())
(:a()a)(a)a(aa(()(::)())(:a(a):()a(a()a(()():)))this is a min cost max flow problem(a)((a(()a)))a
:::)(()::))a:):::()(a(:)(a)a)())::)()(()a)a(a)may the best hacker win:aa:)a()(())aa:::)(:())aa
a(:(((()a)()()a(()()aa(a(a:::aaa(:):)a(a:a((a(())((()((:))))(a()(())():()()(a(()()a)((:)(a))))))))
:a()(())(:a(:(aa)a)):aaa()a(((a(:()))a))a():()a:)(a)aa(a)((():):aa((a)a((()):)((a)(((aa:(()))))
()((:(:)()((:aa)()(():))((a)(:(a(()))((()()a):()())aa)((:())a()(:)a()))a)aaaa)((a(()(a)a(()))))
i am sick today (:()
@KartikTalwar
KartikTalwar / FBHackerCupBeautifulStrings.py
Created January 27, 2013 08:25
Facebook HackerCup - Beautiful Strings
"""
Beautiful Strings
When John was a little kid he didn't have much to do. There was no internet, no Facebook,
and no programs to hack on. So he did the only thing he could... he evaluated the beauty
of strings in a quest to discover the most beautiful string in the world.
Given a string s, little Johnny defined the beauty of the string as the sum of the beauty
of the letters in it.
@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
@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 / 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 / Documentation.md
Last active April 13, 2024 23:09
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 / 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 / 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
import itertools
possible = ['1', '2', '3', '4', '5']
doubles = []
brute = []
def stringPermutations(string):
rez = []