Skip to content

Instantly share code, notes, and snippets.

View Natureshadow's full-sized avatar
💭
Hacking over at EduGit.org, where no users are discriminated against like here!

Dominik George Natureshadow

💭
Hacking over at EduGit.org, where no users are discriminated against like here!
View GitHub Profile
@Natureshadow
Natureshadow / setuptools_requires_alternative.py
Last active March 24, 2017 18:13
setuptools_requires_alternative.py
# © 2017 Dominik George <nik@naturalnet.de>
# Choose any OSI licence you like.
from pkg_resources import get_distribution
def requires_alternative(*alternatives):
""" Allows specifying alternative requirements.
This function takes arbitrarily many distribution specifications as arguments.
It then checks for availability of each. If a distribution is found, the original
specification for it is returned. If none of the alternatives is available,
@Natureshadow
Natureshadow / objringbuffer.js
Created October 31, 2016 00:02
objringbuffer.js
/*
* Copyright (C) 2016 Dominik George <nik@naturalnet.de>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
@Natureshadow
Natureshadow / id_rsa.pub
Last active August 8, 2016 20:10
My public keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDZhvReZ7HYnZYCvqb1sqOpS94AMBIRtUAZwshaocb1CpXcgItCliXNM0VWDdI+8ImfhNrdhKIagPtw/rSIC+Btl7rnz1GE9EjAjQ0LumKan+2NQBlkl1BzNA8JodppFEsTxNH0yt4jauIuFLuq4RvTC+pzN8zIMVOBeHWtL+sOKzian/fd5Q7CaRAvPbWaRnN4IJtQ1KufCjHRWcDfcm/PuLMRvZ7IrhF9IC3ih8Kzo0DRMzqABWSD+N4A1fzFAxhFQgrZSWZaWUdAX6AqpWa5INonN8zXtGgfRw0xzsb7aPl1twC2dDMM4kYTCkhlEvTQueC7jZWClxBYe+1JATHxwy6GOZcG6FKcnFTuN5frMjoo61V0hoYQ6e1Gi7i92X7lLaKk50m5SyfLzm5xPzYRl1sR2XNuHu5NZzaHLjxU7DMvlt+IPfpvTTl3ycdMx52kkluY3Je2ohq1SVmucxiIJYSJTrtDbjIe5o+0AcX3NrXWjlhXe3UFmbNPRuTHadoyUmaNgFrXUYwraay8E4cqD6FMFsWSkZ8z+dEmi/QBGdKA8tqqe6WUoUDs+Ctd156Eah+NF4pylqB0mk3ZcOiJ3CX/+uy7Ne5AZQvMVcQDrEKJZG+IoQVf08/4aRBOiouAnzdINfvGQllobUyjzRxxtNTEyZWzDAf38maGI7k56w== nik@naturalnet.de
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPbgPGGdX12vYEKj4jpJ4znwqGl02Pe2phtqrIMXrlMj nik@naturalnet.de
#!/usr/bin/env python
from datetime import datetime
from time import mktime
import os
def v_to_n(wind, vbatt, ibatt):
""" Merge three values into one 16-bit integer """
return ((wind + 10)<<10) + ((vbatt + 10)<<5) + (ibatt + 10)
@Natureshadow
Natureshadow / microservice-dynport-apache@.service
Last active September 9, 2015 12:17
Quick and dirty hack for microservice port assignment and Apache proxy registration
# This systemd unit can be used to start a Java (Springboot) microservice, and…
# … have it use a context-path depending on the active unit name,
# … have it use a unique port depending on the unit name (a numeric hash),
# … have it register a HTTP proxy pass with Apache.
#
# For the numeric hashing part, this unit depends on the MirBSD Korn Shell (mksh)
# being available.
#
# Copyright © 2015 Dominik George <nik@naturalnet.de>
# Contributions and corrections by Mirko Hoffmann <m.hoffmann@tarent.de>