Skip to content

Instantly share code, notes, and snippets.

View laurivosandi's full-sized avatar

Lauri Võsandi laurivosandi

View GitHub Profile
@laurivosandi
laurivosandi / codemowers-deploy-operators.yaml
Last active September 8, 2023 03:13
Deploy cert-manager, MetalLB, MariaDB, CloudNativePG, Prometheus operators
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: operator-deployment
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
@laurivosandi
laurivosandi / switcharoo.c
Last active November 13, 2017 13:22
Illustrative and probably very buggy example of what su essentially does
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <string.h>
#include <crypt.h>
/**
* Illustrative and probably very buggy example of what su essentially does
*
@laurivosandi
laurivosandi / esp32-oled-demo.py
Last active February 8, 2022 03:22
OLED screen demo on ESP32 with MicroPython
# Pull the SDD1306 lib from here https://github.com/adafruit/micropython-adafruit-ssd1306/blob/master/ssd1306.py
from time import sleep_ms
from machine import Pin, I2C
from ssd1306 import SSD1306_I2C
buf = "wubba lubba dub dub "
i2c = I2C(-1, Pin(4),Pin(5),freq=40000) # Bitbanged I2C bus
assert 60 in i2c.scan(), "No OLED display detected!"
@laurivosandi
laurivosandi / uwebsockets.py
Created August 18, 2017 10:53
Websockets client for MicroPython
"""
Websockets client for micropython
Based very heavily on
https://github.com/aaugustin/websockets/blob/master/websockets/client.py
"""
import ubinascii as binascii
import urandom as random
import ure as re
@laurivosandi
laurivosandi / smarty.py
Created May 12, 2017 15:37
SMART info parser
#!/usr/bin/python
# encoding: utf-8
import subprocess
import os
import re
print "Storage status:"
for node in os.listdir("/dev"):
if not re.match("[sv]d[a-z]$", node): continue
cmd = "/usr/sbin/smartctl", "-a", "/dev/%s" % node
"""
Estonian ID-card authentication middleware for Django,
but this should be pretty easily modifiable for any application
To use install cryptography.io:
apt-get install -y python python-pip python-dev \
python-cffi build-essential libffi-dev libssl-dev
pip install cryptography