This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# WGS84 ellipsoid constants | |
WGS84_A = 6378137 # radius | |
WGS84_E = 8.1819190842622e-2 # eccentricity | |
def LLA2ECEF(lat, lon, alt): | |
""" | |
Converts latitude (deg), longitude (deg) and altitude (m) to ECEF frame | |
https://en.wikipedia.org/wiki/Geographic_coordinate_conversion#From_geodetic_to_ECEF_coordinates | |
Returns: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def unit_vector(vector): | |
return vector / np.linalg.norm(vector) | |
def angle_between(v1, v2): | |
v1_u = unit_vector(v1) | |
v2_u = unit_vector(v2) | |
return np.arccos(np.clip(np.dot(v1_u, v2_u), -1.0, 1.0)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def g_at_distance(g_base, radius, distance): | |
""" | |
Calculate gravitational accelleration at a distance | |
- above the surface G * (radius / distance)^2 | |
- below the surface G * (distance / radius) | |
Parameters | |
---------- | |
g_base : float | |
gravitational accelleration at the surface |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyqrcode | |
from PIL import Image | |
# create background - QR code | |
qr = pyqrcode.create('Some text',error = 'H') | |
qr.png('output.png', scale=10) | |
im = Image.open('output.png') | |
im = im.convert("RGBA") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def s3_to_pandas(client, bucket, key, header=None): | |
# get key using boto3 client | |
obj = client.get_object(Bucket=bucket, Key=key) | |
gz = gzip.GzipFile(fileobj=obj['Body']) | |
# load stream directly to DF | |
return pd.read_csv(gz, header=header, dtype=str) | |
def s3_to_pandas_with_processing(client, bucket, key, header=None): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create private key (any password is ok) | |
openssl pkcs12 -in xxx.pfx -nocerts -out example.key | |
// remove password | |
openssl rsa -in example.key -out example.key | |
// generate private/public pair | |
openssl pkcs12 -in xxx.pfx -out privpub.pem | |
// get public certificate from privpub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Two-dimensional Gaussian function | |
* | |
* @param {number} amplitude | |
* @param {number} x0 | |
* @param {number} y0 | |
* @param {number} sigmaX | |
* @param {number} sigmaY | |
* @returns {Function} | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// array of values | |
var values = [10,8,12,10,11,9,10,12,8,50,10,12,8]; | |
// smoothing whole array | |
function lpf(values, smoothing){ | |
var value = values[0]; | |
for (var i = 1; i < values.length; i++){ | |
var currentValue = values[i]; | |
value += (currentValue - value) / smoothing; | |
values[i] = Math.round(value); |
NewerOlder