Skip to content

Instantly share code, notes, and snippets.

View qistoph's full-sized avatar

Chris van Marle qistoph

  • The Netherlands
View GitHub Profile
@qistoph
qistoph / ntp-gps-oled.py
Created September 26, 2024 14:58
NTPd GPSd OLED display script
#!/usr/bin/python3
import time
from luma.core.interface.serial import i2c
from luma.core.render import canvas
from luma.oled.device import ssd1306
from PIL import ImageFont
import threading
import ntpq
import gps
@qistoph
qistoph / Grafana - Crowdsec.json
Created July 21, 2024 19:06
Crowdsec - Grafana Dashboard and Telegraf/InfluxDB import
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "datasource",
"uid": "grafana"
},
"enable": true,
Example 1:
>>> print(pins2ascii({
1: 'Rst',
2: 'RX',
4: 'Gnd', #'⏚',
5: 'SDA',
6: 'SCL',
8: '5V', #'↑'
}))
@qistoph
qistoph / awk_netstat.sh
Created August 6, 2020 07:55
AWK to get details from /proc/net/tcp and /proc/net/udp when netstat and lsof are not available
# Based on gist https://gist.github.com/staaldraad/4c4c80800ce15b6bef1c1186eaa8da9f
# - added TCP states
awk 'BEGIN{states["01"]="TCP_ESTABLISHED"
states["02"]="TCP_SYN_SENT"
states["03"]="TCP_SYN_RECV"
states["04"]="TCP_FIN_WAIT1"
states["05"]="TCP_FIN_WAIT2"
states["06"]="TCP_TIME_WAIT"
states["07"]="TCP_CLOSE"
@qistoph
qistoph / Temp.ino
Created November 9, 2019 11:40
Premature termination JSON output
#include <OneWire.h>
OneWire ds(D7);
byte addr[8];
byte type_s;
unsigned long readTempAfter;
float celcius = 90;
bool findTemperatureSensor() {
[{"id":1,"first_name":"Hubie","last_name":"Decreuze","email":"[email protected]","gender":"Male","devices":[{"ip":"87.36.171.108","mac":"F2-66-EC-80-8F-91","online":true}]},{"id":2,"first_name":"Barbi","last_name":"Wrout","email":"[email protected]","gender":"Female","devices":[{"ip":"1.224.156.208","mac":"58-E2-87-6E-7B-52","online":true},{"ip":"201.123.160.129","mac":"14-83-DE-1D-27-86","online":true},{"ip":"95.171.216.151","mac":"6F-A5-B3-5D-31-54","online":false}]},{"id":3,"first_name":"Tiffy","last_name":"Hoy","email":"[email protected]","gender":"Female","devices":[{"ip":"102.91.53.51","mac":"D9-0E-01-35-F3-91","online":true},{"ip":"118.185.135.17","mac":"4C-22-C8-98-81-14","online":false}]},{"id":4,"first_name":"Rhett","last_name":"Ryall","email":"[email protected]","gender":"Male","devices":[{"ip":"211.230.8.252","mac":"7A-EB-3D-97-E6-91","online":false},{"ip":"212.23.168.207","mac":"45-74-78-22-48-4D","online":false},{"ip":"93.251.89.14","mac":"6C-AB-5B-17-A1-42","online":true}]},{"id":5,"first_na
@qistoph
qistoph / chartable.md
Last active May 3, 2019 09:29
Character table generator
encodings = ['cp437', 'iso-8859-15', 'windows-1252']
def chr_str(ch, show_class = False, name = ''):
    outstr = ""
    if ch == '':
        outstr += " NA "
@qistoph
qistoph / imapserver.py
Created May 1, 2019 13:26
Simple IMAP server for testing purposes. Copied from bamthomas. Added SSL
#!/usr/bin/python3
# https://raw.githubusercontent.com/bamthomas/aioimaplib/master/aioimaplib/tests/imapserver.py
# aioimaplib : an IMAPrev4 lib using python asyncio
# Copyright (C) 2016 Bruno Thomas
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
@qistoph
qistoph / kpfind.pl
Created August 4, 2017 07:45
Search a list of hashes for your KeePass stored passwords
#!/usr/bin/perl
# Search a list of hashes for your KeePass stored passwords
# e.g. https://haveibeenpwned.com/Passwords
# Chris van Marle 2017
# License: GNU GPLv3
use strict;
use warnings;
use Data::Dumper;
@qistoph
qistoph / ssh-auth-caret.sh
Created July 21, 2017 08:43
Use SSH agent from other client
#!/bin/bash
# See blog for more details:
# https://qistoph.blogspot.nl/2017/07/use-ssh-agent-socket-from-remote-host.html
# Exit if undeclared variables are used
set -o nounset
# Exit if any command exits with error
set -o errexit