Skip to content

Instantly share code, notes, and snippets.

View johannes-scharlach's full-sized avatar

Johannes Scharlach johannes-scharlach

View GitHub Profile
@johannes-scharlach
johannes-scharlach / package.json
Created November 15, 2019 20:07
Renovate configuration
{
"name": "renovate-config-johanness",
"renovate-config": {
"base": {
"extends": [
"config:base",
":onlyNpm",
":preserveSemverRanges",
"johanness:scheduleDuringWorkinghours",
"johanness:maintainLockFile",
@johannes-scharlach
johannes-scharlach / gcp-adapter.js
Created December 11, 2017 18:50
General Cloud Function Abstraction
module.exports = fn => (req, res) => {
const { query, body, method } = req
Promise.resolve(
fn({ query, body }, method)
).then(({ status, responseBody }) => {
res.status(status).send(responseBody)
})
}
@johannes-scharlach
johannes-scharlach / gitclean.sh
Last active February 15, 2023 07:48 — forked from ericelliott/gitclean.sh
gitclean.sh - cleans merged/stale branches from origin
git remote prune origin
git branch -r --merged master | egrep -iv '(main|production)' | sed 's/origin\///g' | xargs -n 1 git push --delete origin
git branch --merged | egrep -v "(^\*|main|production)" | xargs git branch -d

Keybase proof

I hereby claim:

  • I am johannes-scharlach on github.
  • I am johanness (https://keybase.io/johanness) on keybase.
  • I have a public key ASDntJGs49AFfJRAIcYaFzeJLQT1MPfJNvMkf_xUr7RrsQo

To claim this, I am signing this object:

@johannes-scharlach
johannes-scharlach / modex.py
Created August 21, 2014 19:20
Modular exponential
def mod_exp(base, power, modulus):
"""returns base**power % modulus"""
result = 0
if power > 1:
if power % 2 == 1:
result = base * mod_exp(base, power-1, modulus)
else:
results_root = mod_exp(base, power/2, modulus)
result = results_root * results_root
if result > modulus:
@johannes-scharlach
johannes-scharlach / keybase.md
Created August 20, 2014 08:40
Keybase identity

Keybase proof

I hereby claim:

  • I am johannes-scharlach on github.
  • I am johanness (https://keybase.io/johanness) on keybase.
  • I have a public key whose fingerprint is EF91 50CB 4C94 D0DA 4372 F038 E8E7 B929 280F E9C2

To claim this, I am signing this object:

@johannes-scharlach
johannes-scharlach / fibonacci.py
Last active August 29, 2015 14:01
Python Fibonacci function
def fibonacci(n, a=-1, b=1):
return [a, b] if n==0 else fibonacci(n+(n<0)-(n>0), b-a*(n<0), a+b*(n>0))