Skip to content

Instantly share code, notes, and snippets.

View MonksterFX's full-sized avatar
🎯
Focusing

Max Mönch MonksterFX

🎯
Focusing
View GitHub Profile
@MonksterFX
MonksterFX / obsd.sh
Created June 8, 2023 12:37
open booted simulator directory
#!/bin/bash
# id of expo go app / change if you use dev-client
APP_NAME="host.exp.Exponent"
# get data folder from app container
FILE_LOCATION=$(xcrun simctl get_app_container booted "$APP_NAME" data)
# open path in finder
open "$FILE_LOCATION"
@MonksterFX
MonksterFX / base64.js
Last active May 19, 2022 18:54
Encode UTF-8 String To Base64 In Browser
// More Information on Base64
// http://www.sunshine2k.de/articles/coding/base64/understanding_base64.html
// https://gist.github.com/Nijikokun/5192472
// https://developer.mozilla.org/en-US/docs/Glossary/Base64#solution_2_%E2%80%93_rewriting_atob_and_btoa_using_typedarrays_and_utf-8
// convert string to UInt8Array
const enc = new TextEncoder().encode('ääüß');
// calculate filling bytes
const emtpy = enc.length % 3 > 0 ? 3 - (enc.length % 3) : 0;
@MonksterFX
MonksterFX / promisify-express-listen.js
Created April 1, 2022 08:22
promisify express app.listen with server as return value
const app = require('express')();
async function start() {
return new Promise((resolve, reject) => {
// The `listen` method launches a web server.
const server = app.listen();
server.once('listening', resolve(server)).once('error', reject);
});
}
@MonksterFX
MonksterFX / firmware-install.md
Created April 3, 2021 07:41
Micropython Install Firmware Script For ESP32 & ESP8266

Requirements

  • mac/linux terminal zsh
  • zenity installed
  • conda env microptyhon (with all necessary scripts epstools etc.)
  • folder with firmware im bin format
@MonksterFX
MonksterFX / pandas_dataframe_infer_dtypes.py
Created January 18, 2021 22:11
Infer Pandas DataFrame DataTypes
def infer_df(df, hard_mode=False, float_to_int=False, mf=None):
ret = {}
# ToDo: How much does auto convertion cost
# set multiplication factor
mf = 1 if hard_mode else 0.5
# set supported datatyp
integers = ['int8', 'int16', 'int32', 'int64']
floats = ['float16', 'float32', 'float64']
@MonksterFX
MonksterFX / mongo-management-tasks.md
Created October 28, 2020 11:27
Monog Management Tasks

rename a database:

mongodump --uri="<uri>" --archive="mongodump-docker" --db="docker-local"
mongorestore --uri="<uri>" --archive="mongodump-docker" --nsFrom='docker-local.*' --nsTo='main.*'

open shortcut master list

⌘k + s

@MonksterFX
MonksterFX / pipeline-helper.md
Created August 19, 2020 20:10
cli helpers for pipelines

helpers to build your pipeline

stream files (ssh-keys, build.json etc. from pipeline)

echo $FILE > file.txt

extract version from file (in this example from package.json)

VERSION=$(cat package.json | jq -r .version)

clean up directory

getting an overview

show all branches remotes and local

git branch -a

show last commit for each branch

git branch -vv

@MonksterFX
MonksterFX / signed-url-gcs.js
Last active August 19, 2020 07:50
generate signed url for google cloud storage in javascript
const { Storage } = require('@google-cloud/storage');
const storage = new Storage({
keyFilename: '<file_path>',
projectId: '<projectId>',
});
async function generateSignedUrl() {
// These options will allow temporary write access to the file
const options = {