Skip to content

Instantly share code, notes, and snippets.

@auckenox
auckenox / iostat.php
Created October 13, 2018 15:24
php parse iostat data and outputs it as json
<?php
/* requires sysstat: apt install sysstat */
function parseIostatLine($line)
{
$re = '/(?\'device\'[a-z0-9]{3}) \s* (?\'tps\'[\d\.]*) \s* (?\'readS\'[\d\.]*)\s*(?\'writeS\'[\d\.]*)\s*(?\'read\'[\d\.]*)\s*(?\'write\'[\d\.]*)/m';
preg_match_all($re, $line, $matches, PREG_SET_ORDER, 0);
if($matches[0]['read']==''&&$matches[0]['write']==''){return false;}
return array(
"device"=>$matches[0]['device'],
@auckenox
auckenox / ttp229_test.py
Last active February 6, 2018 23:36
ttp229 python i2c raspberry pi pins K0-K7
"""
you will need smbus, install it:
apt install python-smbus
only keys 0-7 are covered by this script
this script will show you which keys you touched
tested with a: 16 Keys I2C Capacitive Touch TTP229 Module
"""
import smbus,time
bus = smbus.SMBus(1)
@auckenox
auckenox / dyson_am05.conf
Last active October 10, 2020 11:12
Dyson Hot + Cool AM05 LIRC Config
# Please make this file available to others
# by sending it to <lirc@bartelmus.de>
#
# this config file was automatically generated
# using lirc-0.9.0-pre1(default) on Wed Jan 10 02:41:27 2018
#
# contributed by auckenox
#
# brand: Dyson Hot + Cool AM05
@auckenox
auckenox / pioneer_axd7745.conf
Created January 10, 2018 01:36
LIRC Config (partial) for Remote AXD7745 for device Pioneer A-50DA
# Please make this file available to others
# by sending it to <lirc@bartelmus.de>
#
# this config file was automatically generated
# using lirc-0.9.0-pre1(default) on Wed Jan 10 02:29:33 2018
#
# contributed by auckenox
#
# brand: pioneer
@auckenox
auckenox / wemos_d1_mini_rfid-rc522.ino
Created September 16, 2017 15:10
wemos d1 mini RFID-RC522 send card uid to webserver
#include <ESP8266WiFi.h>
#include <SPI.h>
#include <MFRC522.h>
/*
hardware: RFID-RC522, wemos d1 mini, some rfid tags, wifi
software: MFRC522 library, webserver (on the other side)
wireing: http://lazyzero.de/elektronik/esp8266/rfid_mqtt/start
get the MFRC522 arduino library from:
get the library at https://github.com/miguelbalboa/rfid
@auckenox
auckenox / move_packages.sh
Last active June 15, 2020 16:12
[PLEASE DO NOT USE THIS SCRIPT ANYMORE] Synology move packages to another volume
#!/bin/bash
# ######################################################################################################
## WARNING: THIS SCRIPT HAS THE POTENTIAL TO HARM YOUR DSM ON CURRENT VERSIONS OF DSM! DO NOT USE IT
# ######################################################################################################
# this script moves ALL packages from volume-x to volume-y
# For Synology DSM - tested with DSM6.1
# change these values
from_vol="volume1"
@auckenox
auckenox / TM1637_ wemos_d1_mini_webserver.ino
Last active December 26, 2022 22:34
ESP8266 I2C 7 segment display TM1637 http webserver
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <TM1637Display.h>
/*
thanks to:
https://github.com/avishorp/TM1637
http://www.esp8266learning.com/tm1637-7-segment-display-example.php
*/
@auckenox
auckenox / arduino_d1_mini_relay_server.ino
Last active December 16, 2022 01:39
wemos webserver for relays (digital out, switch D1,D2,D3,D4)
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
const char* ssid = "my_SSID";
const char* password = "my_PASSWORD";
/*
usage:
@auckenox
auckenox / watchdog.sh
Last active November 4, 2016 21:55
basic watchdog for python (or other) scripts
#!/bin/bash
watchdog () {
datum=$(date -u)
scna="$(basename $1)"
ps -ef | grep $1 | grep -v grep;
if [[ $? -eq 0 ]]; then
echo "$datum - OK, $scna is running";
else
echo "$datum - $1 died, resurrecting $scna now...";