Skip to content

Instantly share code, notes, and snippets.

View adusak's full-sized avatar

Adam Melkus adusak

View GitHub Profile
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
# NASTAVIT VLASTNÍ SLOŽKU S PROJEKTEM
config.vm.synced_folder "../../Workspace/Ruby", "/vagrant_data"
$sudoscript = <<-SHELL
sudo apt-get update -y
sudo apt-get install openssl git -y
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev -y
@adusak
adusak / generate_maze.py
Created June 2, 2015 20:23
Hexagon maze generator
import copy
import math
import random
from python.common.svg import Svg
def coordinate_to_string(i, j):
return str(i) + "," + str(j)
@adusak
adusak / color_lab.py
Created June 2, 2015 20:10
Color maze solver
import copy
import numpy as np
from python.common.line import Line
from python.common.svg import Svg
def load_color_maze(name) -> ({}, str, str, [[str]]):
file = open("labs/" + name, 'r')
@adusak
adusak / number_lab.py
Last active August 29, 2015 14:22
Solver of number maze
from operator import itemgetter
import numpy as np
def load_labyrinth(name):
file = open("labs/" + name, 'r')
text = file.read()
lines = text.split("\n")
@adusak
adusak / clusters.py
Created June 2, 2015 19:31
K-Means cluster finding algorithm
from math import sqrt
from operator import itemgetter
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import animation
from python.less_11.regression import generate_points, load_file
@adusak
adusak / regression.py
Created June 2, 2015 18:36
Regression
import matplotlib.pyplot as plt
import numpy as np
def generate_points(a, b, number_points=500):
x_points = np.random.normal(0, np.random.randint(0, number_points / 10), number_points)
y_points = (a * x_points + b) + np.random.normal(0, number_points / 2, number_points)
return np.array(x_points, dtype=float), np.array(y_points, dtype=float)
@adusak
adusak / central.py
Created June 2, 2015 18:24
Centrální limitní věta
import numpy as np
import matplotlib.pyplot as plt
cube1 = [x / 21 for x in range(1, 7)]
cube2 = list(reversed(cube1))
def cube1_throw(number_throws=1000):
return cube_throw(number_throws, cube1)
@adusak
adusak / nonrandom_numbers.py
Created June 2, 2015 17:57
Checks wheather numbers are random
def analyze():
files = []
for i in range(1, 8):
file = open("random/random" + str(i) + ".txt")
read_file = file.read()
files.append(read_file)
for i in range(len(files)):
read_file = files[i]
@adusak
adusak / monty_hall.py
Created June 2, 2015 17:54
Monty Hall Problem simulator
import random
def monty_hall(door_selection=None, _choice=None):
doors = ["goat" for _ in range(3)]
car_index = random.randint(0, 2)
doors[car_index] = "CAR"
door_number = door_selection
if door_number is None:
@adusak
adusak / fern_star.py
Created June 2, 2015 17:31
Fern and Star
import copy
from python.common.point import Point
from python.common.svg import Svg
from python.less9.transformations import *
def common(size, iterations, transformations, probabilities, name="picture"):
points = []
current = Point(0, 0)