Skip to content

Instantly share code, notes, and snippets.

View Denbergvanthijs's full-sized avatar
:fishsticks:

Thijs van den Berg Denbergvanthijs

:fishsticks:
View GitHub Profile
@Casper-Smet
Casper-Smet / linked_list.py
Last active June 18, 2021 15:53
Linked list in Python based on MutableSequence
from collections.abc import MutableSequence
from dataclasses import dataclass
from typing import Any, Generator
@dataclass
class LinkedNode():
value: Any
next_node: "LinkedNode" = None
@Denbergvanthijs
Denbergvanthijs / game_of_life_keras.py
Last active April 13, 2024 12:44
Conway's Game of Life using a neural network with Keras and Tensorflow in Python
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from matplotlib.animation import FuncAnimation
from tensorflow.keras.layers import Conv2D, InputLayer, Layer
from tensorflow.keras.models import Sequential
size = 128
n_frames = 240
full_size = (1, size, size, 1)
@Denbergvanthijs
Denbergvanthijs / donut.py
Last active June 5, 2024 11:22
3D spinning donut in Python. Based on the pseudocode from: https://www.a1k0n.net/2011/07/20/donut-math.html
import numpy as np
screen_size = 40
theta_spacing = 0.07
phi_spacing = 0.02
illumination = np.fromiter(".,-~:;=!*#$@", dtype="<U1")
A = 1
B = 1
R1 = 1
@stephenhardy
stephenhardy / git-clearHistory
Created April 26, 2013 22:14
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git