Skip to content

Instantly share code, notes, and snippets.

@diefans
diefans / sunrise_sunset_calculation.py
Last active August 30, 2018 18:04 — forked from Alex1Git/sunrise sunset calculation
sunrise sunset calculation / Berechnung Sonnenaufgang und Sonnenuntergang
# Formel von Dr. Roland Brodbeck, Calsky
# http://lexikon.astronomie.info/zeitgleichung/neu.html
# Uebertragung auf Python 3 von Alexander Klupp 2014-01-14
import math
pi2 = 2*math.pi
pi = math.pi
RAD = math.pi/180
@diefans
diefans / yieldable_asyncio_udp_client.py
Created October 4, 2018 11:24 — forked from kwarunek/yieldable_asyncio_udp_client.py
Yieldable/awaitable asyncio UDP client (sendto only actually)
import asyncio
import socket
class UDPClient():
def __init__(self, host, port, loop=None):
self._loop = asyncio.get_event_loop() if loop is None else loop
self._sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self._sock.setblocking(False)
self._addr = (host, port)
@diefans
diefans / Makefile
Created October 4, 2018 23:30 — forked from mpneuried/Makefile
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)
@diefans
diefans / aioudp.py
Created October 15, 2018 14:49 — forked from vxgmichel/aioudp.py
High-level UDP endpoints for asyncio
"""Provide high-level UDP endpoints for asyncio.
Example:
async def main():
# Create a local UDP enpoint
local = await open_local_endpoint('localhost', 8888)
# Create a remote UDP enpoint, pointing to the first one
@diefans
diefans / Makefile
Created April 16, 2019 20:53
Makefile for self-signed cert
ROOT_CA ?= rootCA
CA_EMAIL ?= foobar@foo.bar
COMMON_NAME ?= mail.foobar.box
DAYS ?= 3650
$(ROOT_CA).key: ## Create root CA key.
openssl genrsa -out $@ 4096
$(ROOT_CA).pem: rootCA.key ## Create root CA certificate.
@diefans
diefans / corporate-linux-desktop-howto.md
Created May 10, 2019 12:09 — forked from jtyr/corporate-linux-desktop-howto.md
How to run Linux desktop in a corporate environment

How to run Linux desktop in a corporate environment

DISCLAIMER

Some of the practices described in this HOWTO are considered to be illegal as they often break internal corporate policies. Anything you do, you do at your own risk.

@diefans
diefans / conftest.py
Created September 3, 2019 13:01
aioresponses auto mock resource fixtures
import pytest
@pytest.fixture
def domain_fixtures_path():
import pathlib
fixtures_path = pathlib.Path(__file__).parent / "fixtures"
return fixtures_path
@diefans
diefans / background-xdg-open.sh
Created December 25, 2020 09:03 — forked from guiniol/background-xdg-open.sh
offlineimap + notmuch + mutt + gpg + mstmp
#!/bin/bash
xdg-open "$1" &
sleep 1
@diefans
diefans / http-benchmark.md
Created March 28, 2021 18:42 — forked from denji/http-benchmark.md
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)
@diefans
diefans / mongo_registry.go
Created June 3, 2021 10:38 — forked from SupaHam/mongo_registry.go
mongo-go-driver UUID decoder & encoder for Golang
// This is a value (de|en)coder for the github.com/google/uuid UUID type. For best experience, register
// mongoRegistry to mongo client instance via options, e.g.
// clientOptions := options.Client().SetRegistry(mongoRegistry)
//
// Only BSON binary subtype 0x04 is supported.
//
// Use as you please
package repository
import (