Skip to content

Instantly share code, notes, and snippets.

@ghabs
ghabs / test_data.txt
Last active December 20, 2018 23:48
test_embed
(((())))()((((((((())()(()))(()((((()(()(((()((()((()(()()()()()))(((()(()((((((((((())(()()((())()(((())))()(()(()((()(()))(()()()()((()((()(((()()(((((((()()())()((((()()(((((()(())()(())((())()()))()(((((((())(()())(()(((())(()))((())))(()((()())))()())((((())))(()(((((()(())(((()()((()((()((((((((((())(()())))))()))())()()((((()()()()()()((((((())())(((()())()((()()(((()()()))(((((()))(((()(()()()(()(()(((())()))(()(((()((())()(()())())))((()()()(()()(((()))(((()((((()(((((()()(()())((()())())(()((((((()(()()))((((()))))())((())()()((()(()))))((((((((()))(()()(((())())(())()((()()()()((()((()((()()(((())))(()((())()((((((((()((()(()()(((())())())))(())())))()((((()))))))())))()()))()())((()())()((()()()))(()()(((()(())((((())())((((((((()()()()())))()()()((((()()))))))()((((()(((()))(()()())))((()()(((()))()()())())(((())((()()(())()()()(((())))))()())((()))()))((())()()())()())()()(()))())))())()))(())((()(())))(()(())(()))))(()(())())(()(())(()(()))))((()())()))()((((()()))))())))()()())((())()((()()())
@ghabs
ghabs / data.txt
Created December 20, 2018 23:33
data_advent_1
(((())))()((((((((())()(()))(()((((()(()(((()((()((()(()()()()()))(((()(()((((((((((())(()()((())()(((())))()(()(()((()(()))(()()()()((()((()(((()()(((((((()()())()((((()()(((((()(())()(())((())()()))()(((((((())(()())(()(((())(()))((())))(()((()())))()())((((())))(()(((((()(())(((()()((()((()((((((((((())(()())))))()))())()()((((()()()()()()((((((())())(((()())()((()()(((()()()))(((((()))(((()(()()()(()(()(((())()))(()(((()((())()(()())())))((()()()(()()(((()))(((()((((()(((((()()(()())((()())())(()((((((()(()()))((((()))))())((())()()((()(()))))((((((((()))(()()(((())())(())()((()()()()((()((()((()()(((())))(()((())()((((((((()((()(()()(((())())())))(())())))()((((()))))))())))()()))()())((()())()((()()()))(()()(((()(())((((())())((((((((()()()()())))()()()((((()()))))))()((((()(((()))(()()())))((()()(((()))()()())())(((())((()()(())()()()(((())))))()())((()))()))((())()()())()())()()(()))())))())()))(())((()(())))(()(())(()))))(()(())())(()(())(()(()))))((()())()))()((((()()))))())))()()())((())()((()()())
@ghabs
ghabs / _problem.md
Last active August 13, 2018 01:26
relay game: test

Some positive integers n have the property that the sum [ n + reverse(n) ] consists entirely of odd (decimal) digits. For instance, 36 + 63 = 99 and 409 + 904 = 1313. We will call such numbers reversible; so 36, 63, 409, and 904 are reversible. Leading zeroes are not allowed in either n or reverse(n). There are 120 reversible numbers below one-thousand.

How many reversible numbers are there below one-billion (10^9)?

class Token:
def __init__(self, val, mean):
self.val = val
self.meaning = mean
class Tokenizer:
def sanitized(self, a):
for i in a:
if not i.isdigit():
return False
class Solution(object):
def maxArea(self, height):
"""
:type height: List[int]
:rtype: int
"""
max_x = len(height) - 1;
i = 0
max_area = 0
while (i != max_x):
@ghabs
ghabs / prisonerdilemma.py
Created April 13, 2017 16:18
Command Line Prisoner
import getpass
import sys
class Player(object):
"""Player class that holds name and score"""
def __init__(self, name):
super(Player, self).__init__()
self.name = name
self.points = 0
@ghabs
ghabs / index.html
Last active December 31, 2015 09:29
This is a small program I wrote when I was interested in exploring my text message data and visualizing the frequency. It loads data from a JSON file, creates a scatterplot, and calls an external sentiment API to see if the messages were positive or negative. You can see it ‘live’ here: hsapp.s3-website-us-east-1.amazonaws.com (Firefox only, sin…
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<head>
<!-- JS -->
<script src="jquery.js"></script>
<script type="text/javascript" src="underscore.js"></script>
<script type="text/javascript" src="d3.v3.js"></script>
@ghabs
ghabs / post
Created April 18, 2014 18:16
Post.js
app.post('/headlines', function(req, res) {
var newHeadline = {
author: req.body.author,
text: req.body.text
}
headlines.push(newHeadline);
res.json(200);
});
@ghabs
ghabs / delete.js
Created April 18, 2014 18:15
Delete
app.delete('/headline/:id', function(req, res) {
headlines.splice(req.params.id, 1);
res.json(204);
});
@ghabs
ghabs / app.js
Created April 17, 2014 21:55
Get ID
app.get('/headlines/:id', function(req, res) {
var q = headlines[req.params.id];
res.json(q);
});