Skip to content

Instantly share code, notes, and snippets.

View adusak's full-sized avatar

Adam Melkus adusak

View GitHub Profile
@adusak
adusak / designer.html
Last active August 29, 2015 14:11
designer
<link rel="import" href="../paper-tabs/paper-tabs.html">
<link rel="import" href="../paper-tabs/paper-tab.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
@adusak
adusak / gradient.py
Created March 14, 2015 14:11
Gradient - generates gradient
from PIL import Image
def generate_gradient():
im = Image.new("RGB", (255, 255))
for x in range(255):
for y in range(255):
im.putpixel((x, y), (x, 0, y))
im.save("../../portfolio/less1/gradient.png")
im.show()
@adusak
adusak / gradient.py
Last active August 6, 2016 14:04
Gradient - generates gradient
from PIL import Image
def generate_gradient():
im = Image.new("RGB", (255, 255))
for x in range(255):
for y in range(255):
im.putpixel((x, y), (x, 0, y))
im.show()
@adusak
adusak / combinatorics.py
Last active August 6, 2016 14:04
Combinatorics - permutations, variations, combinations
from enum import Enum
class OpType(Enum):
permutation = 1
variation = 4
variation_repetition = 2
combination = 5
combination_repetition = 3
@adusak
adusak / pascal.py
Last active August 29, 2015 14:17
Generates pascal triangle image
import random
from PIL import Image
import matplotlib.colors as colors
from python.less2.combinatorics import vartiations
'''
' Calculates combination number using cache (doesn't recalculate already calculated values)
'''
@adusak
adusak / Turtle.py
Last active August 29, 2015 14:17
Class for turtle graphics
import sys
from math import cos, sin, radians
from python.common.line import Line
from python.common.svg import Svg
class Turtle:
x_max, x_min, y_max, y_min = - sys.maxsize, sys.maxsize, -sys.maxsize, sys.maxsize
@adusak
adusak / 7uhelnik.svg
Created March 15, 2015 10:48
SVG 7uhelnik
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@adusak
adusak / 9uhelnik.svg
Created March 15, 2015 10:48
SVG of 9uhelnik
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@adusak
adusak / circle.py
Last active August 29, 2015 14:17
Circle in bitmap graphics
import math
from PIL import Image
def circle(r=20, fill=True):
im = Image.new("RGB", (r * 2 + 1, r * 2 + 1), (255, 255, 255))
for a in range(360):
x = int(r + r * math.cos(math.radians(a)))
y = int(r + r * math.sin(math.radians(a)))
@adusak
adusak / spiral.py
Last active August 6, 2016 14:00
Generates bitmap of a spiral
import math
from PIL import Image
def spiral(r=20):
im = Image.new("RGB", (r * 2, r * 2), (255, 255, 255))
inc = 10
inside = True
angle = 0