Skip to content

Instantly share code, notes, and snippets.

@ghabs
ghabs / data.txt
Created December 20, 2018 23:33
data_advent_1
(((())))()((((((((())()(()))(()((((()(()(((()((()((()(()()()()()))(((()(()((((((((((())(()()((())()(((())))()(()(()((()(()))(()()()()((()((()(((()()(((((((()()())()((((()()(((((()(())()(())((())()()))()(((((((())(()())(()(((())(()))((())))(()((()())))()())((((())))(()(((((()(())(((()()((()((()((((((((((())(()())))))()))())()()((((()()()()()()((((((())())(((()())()((()()(((()()()))(((((()))(((()(()()()(()(()(((())()))(()(((()((())()(()())())))((()()()(()()(((()))(((()((((()(((((()()(()())((()())())(()((((((()(()()))((((()))))())((())()()((()(()))))((((((((()))(()()(((())())(())()((()()()()((()((()((()()(((())))(()((())()((((((((()((()(()()(((())())())))(())())))()((((()))))))())))()()))()())((()())()((()()()))(()()(((()(())((((())())((((((((()()()()())))()()()((((()()))))))()((((()(((()))(()()())))((()()(((()))()()())())(((())((()()(())()()()(((())))))()())((()))()))((())()()())()())()()(()))())))())()))(())((()(())))(()(())(()))))(()(())())(()(())(()(()))))((()())()))()((((()()))))())))()()())((())()((()()())
@ghabs
ghabs / test_data.txt
Last active December 20, 2018 23:48
test_embed
(((())))()((((((((())()(()))(()((((()(()(((()((()((()(()()()()()))(((()(()((((((((((())(()()((())()(((())))()(()(()((()(()))(()()()()((()((()(((()()(((((((()()())()((((()()(((((()(())()(())((())()()))()(((((((())(()())(()(((())(()))((())))(()((()())))()())((((())))(()(((((()(())(((()()((()((()((((((((((())(()())))))()))())()()((((()()()()()()((((((())())(((()())()((()()(((()()()))(((((()))(((()(()()()(()(()(((())()))(()(((()((())()(()())())))((()()()(()()(((()))(((()((((()(((((()()(()())((()())())(()((((((()(()()))((((()))))())((())()()((()(()))))((((((((()))(()()(((())())(())()((()()()()((()((()((()()(((())))(()((())()((((((((()((()(()()(((())())())))(())())))()((((()))))))())))()()))()())((()())()((()()()))(()()(((()(())((((())())((((((((()()()()())))()()()((((()()))))))()((((()(((()))(()()())))((()()(((()))()()())())(((())((()()(())()()()(((())))))()())((()))()))((())()()())()())()()(()))())))())()))(())((()(())))(()(())(()))))(()(())())(()(())(()(()))))((()())()))()((((()()))))())))()()())((())()((()()())
@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 / 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);
});
@ghabs
ghabs / app.js
Created April 17, 2014 21:50
Updated App
var express = require('express');
var app = express();
var headlines = [
{ author : 'John Smith', text : "You will not believe what this child does next."},
{ author : 'Jane Doe', text : "It started as a protest, then turned into a party. Thats not even the interesting part."},
{ author : 'Alice Example', text : "Can we squeeze two hundred jellybeans in one package? Yah probably."},
{ author : 'Bob Allan', text : "This famous celebrity is opposed to something you are too."}
];