Skip to content

Instantly share code, notes, and snippets.

@inytar
inytar / link_lists.py
Created January 20, 2017 20:30
Linked Lists
@inytar
inytar / egyption_fractions.py
Created January 17, 2017 23:07
Hank & Pieter egyption fractions
def decompose(n):
# your code
num, _, den = n.partition('/')
if not den:
den = 1
if '.' in num:
pred, _, postd = num.partition('.')
num = int(pred) * 10**(len(postd))
num += int(postd)
den *= 10**(len(postd))
@inytar
inytar / Hamming numbers
Created January 10, 2017 23:16
Hamming numbers solution by Ben & Pieter for 2017-01-10
data = []
def hamming(n):
return data[n - 1]
def calc_hamming(i, j, k):
return 2**i * 3**j * 5**k
for i in range(50):
for j in range(50):
@inytar
inytar / Graphs 2016_12_16.ipynb
Last active January 30, 2022 01:03
Graphs 2016_12_16
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#! python3
# coding: utf-8
import argparse
import collections
from http.server import BaseHTTPRequestHandler
from http.server import HTTPServer
import json
from urllib import parse
@inytar
inytar / image_mangler.py
Created August 1, 2016 20:26
Script that mangles images by switching color comparable spots in the image.
#! python3
# coding: utf-8
"""Script to mangle images.
This script mangles images by switching color comparable spots in the image.
This script uses the pillow python package.
"""
from __future__ import print_function