Skip to content

Instantly share code, notes, and snippets.

View ernestum's full-sized avatar

M. Ernestus ernestum

  • Leipzig, Germany
View GitHub Profile

Keybase proof

I hereby claim:

  • I am ernestum on github.
  • I am ernestum (https://keybase.io/ernestum) on keybase.
  • I have a public key ASCOS_X7V96tqJPjqiqYbp9dQxT08A98m0UxjkCjstgQpgo

To claim this, I am signing this object:

@ernestum
ernestum / episode_generation.py
Created July 5, 2019 08:17
An efficient way of generating a large number of trajectories for a QuadrotorEnvironment
import time
import numpy as np
from quadrotor_environment.quadrotor_model import SysState
from quadrotor_environment.simulation_parameter_randomization import SPRWrappedQuadrotorEnvironment
from stable_baselines import PPO2
state_dtype = np.dtype([("position", np.float, 3),
("velocity", np.float, 3),
("rotation", np.quaternion),
@ernestum
ernestum / pip freeze output
Created February 11, 2019 18:07
pip3 freeze 11.2.2019
absl-py==0.6.1
alabaster==0.7.10
AnyQt==0.0.8
apptools==4.4.0
apt-clone==0.2.1
apt-xapian-index==0.47
apturl==0.5.2
astor==0.7.1
atari-py==0.1.6
atomicwrites==1.2.1
# -*- coding: utf-8 -*-
import math
import re
import time
def extractTerms(document):
'''
Extracts all the terms (lowercased) from a document string.
'''
return [t.lower() for t in re.split("\W+", document)]
@ernestum
ernestum / elastic_transform.py
Last active November 2, 2023 10:26 — forked from fmder/elastic_transform.py
Elastic transformation of an image in Python
import numpy as np
from scipy.ndimage.interpolation import map_coordinates
from scipy.ndimage.filters import gaussian_filter
def elastic_transform(image, alpha, sigma, random_state=None):
"""Elastic deformation of images as described in [Simard2003]_.
.. [Simard2003] Simard, Steinkraus and Platt, "Best Practices for
Convolutional Neural Networks applied to Visual Document Analysis", in
Proc. of the International Conference on Document Analysis and
Recognition, 2003.
@ernestum
ernestum / MaximalSumSubsequence.py
Created October 28, 2015 15:20
Linear Time Divide and Conquer Maximal Sum Subsequence Algorithm
# -*- coding: utf-8 -*-
import random
'''
ACTUAL ALGORITHM START
'''
def getMaximumSumSubsequenceInformation(sequence, start, end):
'''
Returns information regarding the subsequence with maximal sum in the given
@ernestum
ernestum / Control Continous Servo with 2 Pots
Last active December 24, 2015 09:19
The pot at the speed pot pin determines the overall speed (forwards and backwards might be asymmetric! The pot at the direction pot pin determines the direction. * all the way down: full speed backward * down: backwards * middle: stop * up: forwards * all the way up: full speed forward
#include <Servo.h>
int servoPin = 9, speedPotPin = A0, directionPotPin = A1;
Servo servo;
void setup()
{
Serial.begin(9600);
pinMode(servoPin, OUTPUT);
pinMode(speedPotPin, INPUT);
pinMode(directionPotPin, INPUT);