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 / 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 / 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 (:()

Introduction

  • Intermediate level
  • Problem solving
    • Algorithms
    • Data Structures

Topics

# Function recreating the functionality of float() and int() in Python.
# By Neil Fraser. Public Domain. 2012.
def myFloat(input = 0.0):
if type(input) != str:
if type(input) == bool:
return input and 1.0 or 0.0
if type(input) == float:
return input
if type(input) in (int, long):
{
"response":{
"meta":{
"Requests":"0",
"Timestamp":"2013-02-12T22:55:04-05:00",
"Status":"200",
"Message":"OK",
"Version":"1.4b7"
},
"data":{
@KartikTalwar
KartikTalwar / CoderDojo.md
Last active August 1, 2018 17:50
GitHub CoderDojo - Intro to D3.js

Animations in JavaScript

D3.js

Library that uses HTML, CSS and SVG to bring data to life.

Setting Up

package { 'Droplr':
source => 'https://droplr.com/download/mac',
provider => 'compressed_app'
}
package { 'Alfred':
provider => 'compressed_app',
source => 'http://cachefly.alfredapp.com/alfred_1.3.3_267.zip'
}
parser = argparse.ArgumentParser(description='Generic API')
parser.add_argument('--name', dest='name', help='full name')
parser.add_argument('--token', dest='fbtoken', help='firebase token')
args = parser.parse_args()
name = args.name
firebase = args.fbtoken
fname, lname = name.split()
<body style=margin:0><canvas id=q /><script>var q=document.getElementById('q'),s=window.screen,w=q.width=s.width,h=q.height=s.height,p=Array(256).join(1).split(''),c=q.getContext("2d"),m=Math,r=m.random;setInterval(function(){c.fillStyle="rgba(0,0,0,0.05)";c.fillRect(0,0,w,h);c.fillStyle="rgba(0,255,0,1)";p=p.map(function(v,i){c.fillText(String.fromCharCode(m.floor(2720+r()*33)),i*10,v);v+=10;if(v>768+r()*10000)v=0;return v})},33)</script>
<?php
$key = ''; // enter your api key here
function getLocations($key)
{
$url = "http://api.uwaterloo.ca/public/v1/?key=$key&service=APLocations";
$get = file_get_contents($url);