Skip to content

Instantly share code, notes, and snippets.

Kasper Fredenslund kasperfred

Block or report user

Report or block kasperfred

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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 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];
@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 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
View parallel.py
tf.convert_to_tensor([[x,y] for x in range(kernel_size) for y in range(kernel_size)], dtype=tf.float32)
@kasperfred
kasperfred / consent_modal.html
Created Aug 17, 2018
kasperfred.com privacy policy
View consent_modal.html
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 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
@kasperfred
kasperfred / editor.css
Last active Feb 4, 2018
Custom CSS for vscode editor
View editor.css
.monaco-editor .scroll-decoration {
box-shadow: none;
}
.monaco-editor .margin-view-overlays .line-numbers{
curser: default;
}
.monaco-editor .dirty-diff-modified{
border-left: 2px solid #0c7d9d;
}
.monaco-editor .dirty-diff-added{
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.
You can’t perform that action at this time.