Skip to content

Instantly share code, notes, and snippets.

@nmante
nmante / recursion.py
Created November 26, 2016 00:53
Two examples of recursion: the fibonacci sequence, and the towers of hanoi.
#!/usr/bin/env python
"""
Nii Mante
November 23rd, 2016
To execute the fibonacci sequence with 5 numbers, use a command like so
python recursion.py fib -n 5
To execute the hanoi game with 4 disks, use a command like so
@nmante
nmante / Makefile
Last active March 4, 2017 04:06
Given a set of N=4 numbers, determine if combining the 4 numbers via mathematical operations == 24
CC=g++
CFLAGS=-g -std=c++11
EXE=find24
EXE2=find24Memoize
all: $(EXE) $(EXE2)
$(EXE): find24.cpp
$(CC) $(CFLAGS) find24.cpp -o $(EXE)
@nmante
nmante / base_cache.py
Last active May 3, 2018 10:51
Caching Example
class BaseCache(object):
def load(self, key, **kwargs):
raise NotImplementedError
def write(self, key, record, **kwargs):
raise NotImplementedError
def delete(self, key, **kwargs):
raise NotImplementedError
@nmante
nmante / main.py
Created November 8, 2018 21:03
Caption Converter
#!/usr/local/bin/python3
import boto3
import json
import logging
import subprocess as sp
import argparse
import os
def create_parser():