{{ message }}

Instantly share code, notes, and snippets.

# Marlon Etheredge ofx

• The Netherlands
Last active Nov 18, 2019
View rbf.py
 #!/usr/bin/python import math import numpy as np from numpy import linalg as LA # Function to approximate def f(x):
Last active Nov 15, 2018
View bitfield.cpp
 #include #include #include #include #include #include template class bitfield : public std::bitset { public: bitfield(std::array bytes)
Last active Nov 10, 2018
16-bits ALU
View alu16.cpp
 #include #include #include #include #include #define ALU_ADD 0 #define ALU_SUB 1 #define ALU_AND 2 #define ALU_OR 3
Created Sep 18, 2018
View convert_n_based_numbersystem.py
 def convert(x, N): y = x % N x = x // N if (x == 0): return [y] else: return convert(x, N) + [y] print(convert(10001, 16))
Created Aug 18, 2018
Created Jul 18, 2018
View bc.py
 import sys # Constants OPERATORS = ['*', '/', '+', '-'] DECIMAL_SYMBOLS = [',', '.'] SIGN_SYMBOLS = ['-', '+'] PARENTHESIS_OPEN = '(' PARENTHESIS_CLOSE = ')' PRECEDENCE = [[PARENTHESIS_OPEN], ['*', '/'], ['+', '-']]
Last active Mar 29, 2018
Collatz Conjecture
View collatz.cpp
 #include #include #include constexpr const std::tuple max(const unsigned int a, const unsigned int b) { const auto c = [](auto&& s, const unsigned long n) constexpr -> const unsigned int { if (n == 1) return 1; return 1 + s(s, n % 2 ? n * 3 + 1 : n / 2); };
Created Feb 26, 2018
View git submodule rm
 #!/bin/bash if [ "\$1" != "" ]; then git submodule deinit -f -- \$1 rm -rf .git/modules/\$1 git rm -f \$1 fi
Created Sep 28, 2017
View Lens distortion GLSL
 float k1 = 0.0; float k2 = 0.0; float k3 = 0.0; float p1 = 0.0; float p2 = 0.0; const int lk = 12; void mainImage( out vec4 fragColor, in vec2 fragCoord )
Created Mar 17, 2015
Build a kd-tree for 2d points, with two consecutive x-levels and one y-level.
View gist:f3b28f5765b5a7d8edc3
 #!/usr/bin/python import sys import numpy import Queue import numpy as np import random import matplotlib.pyplot as plt