Skip to content

Instantly share code, notes, and snippets.

View Nircek's full-sized avatar

Marcin Zepp Nircek

View GitHub Profile
@Nircek
Nircek / randomart.html
Last active July 18, 2023 06:22 — forked from malexmave/randomart.html
"Drunk Bishop" RandomArt algorithm (from SSH), implemented as Javascript. Only demo code here, but can be trivially changed to give some return value to do something with the randomart.
<!-- I was recently asked what license this code is under. Since it is fairly trivial code,
I don't really feel it "deserves" a "real" license, so I am hereby placing it in the public domain.
In countries where this is not posible, I am placing it under Creative Commons CC0
(https://creativecommons.org/publicdomain/zero/1.0/), which is basically just a more formal way of
putting it in the public domain for people who like to be sure.
If you want to credit me anyway, that is of course fine with me :) -->
<!DOCTYPE html>
<html>
<body>
<div id="renderDiv" style='font-family:"Lucida Console", Monaco, monospace' />
@Nircek
Nircek / maze_generator.py
Created August 27, 2022 15:26 — forked from Marwyk2003/maze_generator.py
Maze generation algorithm using iterative dfs
from random import shuffle, randint
from PIL import Image
def generate_maze(X, Y):
'''
Generate a maze and return its walls
Return type (x_walls, y_walls)
x_walls/y_walls - bool array, True = wall, False = no wall
x_walls/y_walls ordered from left to right / top to bottom
'''
@Nircek
Nircek / pythonprimes.py
Last active March 11, 2019 18:55 — forked from willtownes/pythonprimes
Faster way to list primes in Python
def listprimes2(m):
'''another attempt to list all primes below m'''
values = range(m+1) #note that in this list the key and the value are the same.
primes = list(values)[:]
primes[1] = 0 #1 doesn't count as a prime
for i in values:
if primes[i] == 0:
pass
else:
for j in values[i+1:]: