Skip to content

Instantly share code, notes, and snippets.

Avatar

Kasper Fredenslund kasperfred

View GitHub Profile
View autodiff.py
"""Graph based autodiff
Supports two modes
- Forward mode
- Reverse mode (much more efficient)
We use reverse mode
Yet the graph method is still inefficient
"""
import numpy as np
class Expression():
View looking at german streetsigns.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View q_learning.py
import gym
import numpy as np
import matplotlib.pyplot as plt
env_type = "FrozenLake8x8-v0"
algorithm_type = "q_learning"
policy_type = "epsilon_greedy"
run_name = 'run-{0}-{1}-{2}'.format(env_type, algorithm_type, policy_type)
# Random seed
@kasperfred
kasperfred / greek_letters.jsonc
Last active Feb 26, 2019
Autocomplete for latex-like greek letters.
View greek_letters.jsonc
{
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// "Print to console": {
// "scope": "javascript,typescript",
View ml98.m
%% Constants
segments = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"] % replace 'j' with the sub-assignment letter
% lowercase only
%% A
% sun
P = [0, 0];
M = 10;
% planet
p = [1, 0];
View ml84.m
%% options
clear_frames_after = 5;
segment = "c"; % can be 'a', 'b', or 'c'.
%% diff eqs
%because r=1
px = @(t,x) cos(t)-x;
py = @(t,y) sin(t)-y;
p = @(t,x,y) [px(t,x),py(t,y)];
View password_hash.py
import hashlib
import random
import string
def hash_password(password, salt=None, iterations=100000):
"""
Hash a string using SHA3-512
input:
String: password
You can’t perform that action at this time.