Skip to content

Instantly share code, notes, and snippets.

View ali01's full-sized avatar

Ali Yahya ali01

View GitHub Profile

Keybase proof

I hereby claim:

  • I am ali01 on github.
  • I am alive (https://keybase.io/alive) on keybase.
  • I have a public key whose fingerprint is 1E9A DEC5 A1E5 5C37 5B87 D891 8884 8CCF 6A64 CB53

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am ali01 on github.
  • I am alive (https://keybase.io/alive) on keybase.
  • I have a public key whose fingerprint is A28C 594C 575E C3F4 3F05 135C 5D50 EC81 9FC5 BD70

To claim this, I am signing this object:

setopt prompt_percent prompt_subst
autoload colors zsh/terminfo
colors
for color in RED GREEN YELLOW BLUE MAGENTA WHITE BLACK CYAN; do
eval CL_$color='%{$fg[${(L)color}]%}'
eval CL_BOLD_$color='%{$fg_bold[${(L)color}]%}'
done
@ali01
ali01 / 0-example.txt
Last active August 29, 2015 14:02
Random Maze Generator
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| S | | | |
+ +---+ +---+---+ +---+---+ +---+ + +---+ +---+
| | | | | | | | |
+ +---+ + +---+ + +---+ +---+---+---+---+ + +
| | | | | | | | | | |
+ + +---+ +---+---+---+ +---+ + + + +---+ +
| | | | | | |
+---+ + +---+ +---+ + +---+ +---+ + +---+ +
| | | | | | | | | |
@ali01
ali01 / Makefile
Last active August 29, 2015 14:00
Program to extract the N longest lines of a file
all:
g++ -O2 -std=c++11 longest.cpp -o longest
run: longest
@./longest
clean:
rm -rf longest
@ali01
ali01 / btree_reconstruct.py
Last active December 17, 2017 17:11
Reconstruct Binary Tree from In-Order and Post-Order Traversals
#!/usr/bin/env python
class Node(object):
def __init__(self, value):
self.value = value
self.left = None
self.right = None
def reconstruct_binary_tree(in_order, post_order):

Here is an essay version of my class notes from Class 1 of CS183: Startup. Errors and omissions are my own. Credit for good stuff is Peter’s entirely.

CS183: Startup—Notes Essay—The Challenge of the Future

Purpose and Preamble

@ali01
ali01 / memoizer.py
Created January 11, 2013 03:44
Function that returns a decorator to memoize stateless functions. Args: secs - Amount of time (in seconds) to keep values in the cache; the argument may be a floating point number to indicate a more precise timeout.
import functools
import hashlib
import time
def memoize(secs=0):
'''Returns a decorator to memoize stateless functions.
Args: secs - Amount of time (in seconds) to keep values in the cache;
The argument may be a floating point number to indicate a
more precise timeout.