Skip to content

Instantly share code, notes, and snippets.

View corny's full-sized avatar

Julian Kornberger corny

View GitHub Profile
@corny
corny / dhcp_discover.go
Created October 28, 2017 19:02
DHCP discover with Go and raw sockets
package main
import (
"log"
"math/rand"
"net"
"os"
"os/signal"
"syscall"
@corny
corny / photobox.py
Last active October 7, 2017 20:30
Raspberry Pi + Picamera = Photobox
#!/usr/bin/env python3
import bottle
import datetime
import picamera
import RPi.GPIO as GPIO
import sys
import signal
import threading
import time
@corny
corny / puma.service
Created September 24, 2017 14:20
Puma mit Socket Activation
[Unit]
Description=Puma HTTP Server
After=network.target
Requires=puma.socket
[Service]
User=wiki
# Helpful for debugging socket activation, etc.
Environment=PUMA_DEBUG=1
@corny
corny / txt2pdf.py
Last active May 6, 2017 11:40
Wandelt .txt-Emails von Fragdenstaat in PDFs um
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from pylatex import *
from pylatex.utils import italic
import fileinput
import sys
from email.header import decode_header, make_header
import io
import argparse
@corny
corny / Makefile
Last active July 14, 2021 15:57
Redirecting HTTP server
CC=gcc
CFLAGS=-I. -Wall -Wextra
OBJ = redirect.o
redirect: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS)
clean:
rm -f redirect redirect.o
@corny
corny / outdoor.ino
Created February 12, 2017 23:04
ESP8266 + SDS011 + BME280
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h>
#include <WiFiClientSecure.h>
#include <SoftwareSerial.h>
#include <Wire.h>
#include <Adafruit_BME280.h>
#include "Sds011.h"
@corny
corny / sensor.ino
Last active March 25, 2019 16:33
Sensor with ESP8266, BME280, ZH-18 and SSD1306
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <PubSubClient.h>
#include <Adafruit_BME280.h>
#include <Wire.h>
#include <SSD1306.h>
#include "settings.h"
const int baudrate = 115200;
#define SDA D3
@corny
corny / mysql-zfs-snapshot.py
Last active January 19, 2017 12:04
Create a consistent MariaDB/MySQL snapshot with ZFS
#!/usr/bin/env python
#
# ./$scriptname zroot/var/mysql@$(date +"%FT%H:%M")
#
# Dependencies for FreeBSD:
# pkg install py27-mysql-connector-python2
import mysql.connector
import subprocess
import sys
@corny
corny / producer_consumers.rb
Last active January 4, 2017 17:37
Ruby consumers/producers pattern with queue.close
#!/usr/bin/env ruby
require 'thread'
queue = Queue.new
# start producer
Thread.new do
100.times do |i|
queue << i
end
@corny
corny / decode-openssh-cert.py
Last active October 13, 2023 20:08
OpenSSH certificate decoder in Python
#!/usr/bin/env python2
#
# OpenSSH certificate decoder in Python
#
# References:
# - https://tools.ietf.org/html/rfc4251.html#section-5
# - http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.certkeys?annotate=HEAD
#
# Copyright (c) 2016 Julian Kornberger <jk+github@digineo.de>
#