Skip to content

Instantly share code, notes, and snippets.

View xvzf's full-sized avatar

Matthias Riegler xvzf

View GitHub Profile
@xvzf
xvzf / ayu.vim
Created July 8, 2018 21:03
Lightline ayu light theme
" ayu light theme
let s:white = [ '#fafafa', 234 ]
let s:white2 = [ '#ffffff', 236 ]
let s:white3 = [ '#f5f5f5', 242 ]
let s:text = [ '#6e7580', 253 ]
let s:blue = [ '#55b4d4', 75 ]
let s:cyan = [ '#4cbf99', 116 ]
let s:green = [ '#86b300', 150 ]
let s:orange = [ '#fa6e32', 220 ]
let s:purple = [ '#a37acc', 183 ]
@xvzf
xvzf / prim.py
Created July 18, 2018 21:25
Prim
from typing import Dict, Tuple
from pprint import pformat
# Example graph
graph_slides = {
0: {1: 8, 2: 2},
1: {0: 8, 2: 7, 3: 9, 4: 5},
2: {0: 2, 1: 7, 4: 6},
3: {1: 9, 4: 3, 5: 1},
4: {2: 6, 1: 5, 3: 3, 5: 4},
@xvzf
xvzf / main.go
Last active April 28, 2019 07:39
Lanarama Morse Uplink
package main
import (
"crypto/rand"
"fmt"
"net"
"time"
)
type morse struct {
@xvzf
xvzf / traefik_dump.py
Created May 28, 2019 07:14
Traefik certificate extract
import sys
import json
import base64
def extract(acme_path, extract_domain, out_name):
with open(acme_path, "r") as f:
acme = json.loads(f.read())
for certificate in acme["Certificates"]:
domain = certificate["Domain"]["Main"]
@xvzf
xvzf / whoami.yaml
Created June 3, 2019 14:41
Whoami demo deployment on k8s (or k3s)
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: whoami-deployment
labels:
app: whoami
spec:
replicas: 3
selector:
@xvzf
xvzf / s3.go
Created June 15, 2019 12:43
S3 go parallelize
package main
import (
"fmt"
"io/ioutil"
"log"
"strings"
"sync"
"github.com/aws/aws-sdk-go/aws"
@xvzf
xvzf / json.py
Last active June 22, 2019 19:58
Jsonify nested datetime objects to isoformat in dicts, lists and dataclasses (Python 3.7)
import collections
from dataclasses import is_dataclass, asdict
from datetime import datetime
from ujson import dumps as ujson_dumps
def dumps(obj):
def convert_to_basic(o):
if isinstance(o, dict):
@xvzf
xvzf / gitea_docker_compose.yaml
Created December 10, 2019 13:54
Traefik Docker
version: "3.1"
services:
db:
image: postgres:11.4-alpine
restart: always
environment:
POSTGRES_USER: gitea
POSTGRES_DB: gitea
POSTGRES_PASSWORD: gitea
volumes:
@xvzf
xvzf / 5_3.c
Created February 19, 2020 22:35
MPT Sh$t
/********************************************************************/
/* Hochschule fuer Technik und Wirtschaft */
/* Fakultät fuer Ingenieurwissenschaften */
/* Labor fuer Eingebettete Systeme */
/* Mikroprozessortechnik */
/********************************************************************/
/* */
/* C_Übung.C: */
/* Programmrumpf fuer C-Programme mit dem Keil */
/* Entwicklungsprogramm uVision fuer ARM-Mikrocontroller */
from flask import Flask
from flask_mqtt import Mqtt
def create_app():
app = Flask(__name__)
app.config['MQTT_BROKER_URL'] = 'mosquito.lanarama.local' # use the free broker from HIVEMQ
app.config['MQTT_BROKER_PORT'] = 1883 # default port for non-tls connection
app.config['MQTT_USERNAME'] = '' # set the username here if you need authentication for the broker
app.config['MQTT_PASSWORD'] = '' # set the password here if the broker demands authentication
app.config['MQTT_KEEPALIVE'] = 5 # set the time interval for sending a ping to the broker to 5 seconds