Skip to content

Instantly share code, notes, and snippets.

View FirefoxMetzger's full-sized avatar

Sebastian Wallkötter FirefoxMetzger

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@FirefoxMetzger
FirefoxMetzger / setup.py
Created August 12, 2020 08:11
Updated setup.py to use correct openMP flag for msvc
#! /usr/bin/env python
import os
import sys
import tempfile
import shutil
import builtins
import textwrap
import setuptools
@FirefoxMetzger
FirefoxMetzger / cifar10_res.py
Last active August 4, 2021 19:49
a residual network using Keras' Sequential() API training on CIFAR10
'''Train a simple residual network on the CIFAR10 small images dataset.
It gets to 75% validation accuracy in 25 epochs, and 79% after 50 epochs.
(it's still underfitting at that point, though).
'''
from __future__ import print_function
import keras
from keras.datasets import cifar10
from keras.preprocessing.image import ImageDataGenerator
@FirefoxMetzger
FirefoxMetzger / project-3d-camera-info.py
Created March 24, 2021 13:13
An example on performing a 3D projection using Ignitionrobotics, gym-ignition and ropy.
from scenario import gazebo as scenario_gazebo
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Circle
from scipy.spatial.transform import Rotation as R
import ropy.transform as tf
import ropy.ignition as ign
def camera_parser(msg):
12026 execve("/usr/bin/git", ["git", "clone", "--sparse", "https://github.com/microsoft/WSL"...], 0x7fff95630170 /* 22 vars */) = 0
12026 brk(NULL) = 0x5565d9152000
12026 arch_prctl(0x3001 /* ARCH_??? */, 0x7ffd1d104450) = -1 EINVAL (Invalid argument)
12026 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
12026 openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
12026 fstat(3, {st_mode=S_IFREG|0644, st_size=97898, ...}) = 0
12026 mmap(NULL, 97898, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f4cfd2b5000
12026 close(3) = 0
12026 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libpcre2-8.so.0", O_RDONLY|O_CLOEXEC) = 3
12026 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340\"\0\0\0\0\0\0"..., 832) = 832
@FirefoxMetzger
FirefoxMetzger / ThresholdArm.ipynb
Created November 22, 2020 11:57
Automatically select a crop to threshold an arm
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@FirefoxMetzger
FirefoxMetzger / config.yml
Last active October 29, 2020 14:11
Vouch Proxy Config for Auth0. Accompanying the post https://sebastianwallkoetter.wordpress.com/2020/10/29/sso-for-your-app/
# vouch config
# bare minimum to get vouch running with OpenID Connect (such as okta)
vouch:
logLevel: debug
testing: true
listen: 0.0.0.0
port: 9090
allowAllUsers: true
@FirefoxMetzger
FirefoxMetzger / gist:c7dfaea6a8717b4469db34aab81f0d08
Created October 29, 2020 13:36
Vouch Proxy Config for Auth0
# vouch config
# bare minimum to get vouch running with OpenID Connect (such as okta)
vouch:
logLevel: debug
testing: true
listen: 0.0.0.0
port: 9090
allowAllUsers: true
import numpy as np
random_numbers = np.random.rand(int(2e8)).tolist()
def random():
try:
return random_numbers.pop()
except IndexError:
raise IndexError("Out of random numbers; generate more next time.")
import timeit
number = 10000
numpy_time = timeit.timeit("[np.random.rand() for _ in range(int(1e3))]", "import numpy as np", number=number)
random_time = timeit.timeit("[random.random() for _ in range(int(1e3))]", "import random", number=number)
numpy_batch_time = timeit.timeit("np.random.rand(int(1e3))", "import numpy as np", number=number)
print("Timings")
print("=======")
print(f"Numpy Single: {numpy_time:.3f}")