Skip to content

Instantly share code, notes, and snippets.

View zouppen's full-sized avatar

Joel Lehtonen OH64K zouppen

View GitHub Profile
@zouppen
zouppen / tapip
Last active October 9, 2019 07:46
Show originating IP address and connection time of SSH tap device
#!/bin/sh -eu
if test $# -ne 1; then
echo Usage: $0 TAP_DEVICE >&2
exit 2
fi
sidfile=`grep -slE "^iff:.*$1$" /proc/*/fdinfo/* | sed 's|[^/]*/[^/]*$|sessionid|'`
if test "$sidfile"; then
@zouppen
zouppen / README.md
Last active June 8, 2019 16:01
Linux netconsole helper scripts

Linux netconsole helper scripts

Allows remote logging via Linux netconsole. Contains helper scripts for both source (local) and sink (remote) systems using systemd.

Features:

  • Automatic detection of source interface and address
  • Automatic detection of target MAC address (or gateway address) to make logging unicast instead of Ethernet broadcast
  • Resolves hostnames to IP address at initialization time
  • Supports multiple instances using systemd @-notation.
@zouppen
zouppen / README.md
Last active March 23, 2019 11:16
How to give persistent names to SSH tap connections and bridge them

This gist has been moved to a GitHub repo. Go there!

@zouppen
zouppen / README.md
Last active October 13, 2018 07:44
Tool for checking SSL certificate expiration dates

SSL certificate expiration checker

Useful for Icinga or other alert tool. Checks certificates from service, not file. This detects cases where certificate is renewed but not updated.

Public domain.

HTTPS

From c49dd95565866ddb001af60c3145a0f6f16ac6ab Mon Sep 17 00:00:00 2001
From: Joel Lehtonen <[email protected]>
Date: Fri, 9 Mar 2018 15:32:15 +0200
Subject: [PATCH] Use specific version of codec2 library
---
cmake/BuildCodec2.cmake | 1 +
1 file changed, 1 insertion(+)
diff --git a/cmake/BuildCodec2.cmake b/cmake/BuildCodec2.cmake
@zouppen
zouppen / kiosk
Last active October 10, 2017 21:43
Mosh / SSH / Telnet prompt
#!/bin/bash -eu
fail () {
echo
echo "Paina enteriä palataksesi valikkoon."
read
}
tmpfile=`mktemp`
dialog --menu "Mitä tehdään?" 10 30 3 mosh "MObile SHell" ssh "Secure SHell" telnet "TELNET protocol" --inputbox "Anna käyttäjä@palvelin:" 8 40 2>$tmpfile
@zouppen
zouppen / montecarlo.c
Last active November 18, 2017 06:02
Monte Carlo Pi with fixed point arithmetic
// -*- mode: c; c-file-style: "linux" -*-
//
// Monte Carlo estimate of pi optimized to use fixed-point arithmetics
// instead of FPU. By [email protected]
//
// NB! I left error checks away for clarity. Never access files in
// real life without checking return values!!
//
// Compile with `gcc --std=gnu99 -Wall -o montecarlo montecarlo.c`
@zouppen
zouppen / pinout.md
Last active January 29, 2017 19:41
Telepulssi oy TP-KN10 reverse engineering

Telepulssi Oy TP-KN10

Display with 8 LED segment displays of size 5x7. Reverse engineered by kahvikello & Zouppen.

Slave board pinout:

Pin Description Atmega328 pin Duemilanove/Uno pin
1 5V 5V
2 5V 5V
@zouppen
zouppen / authorized_keys
Last active January 20, 2017 20:24
Git autodeployment script
command="~/git_deploy_hook",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty DEPLOYMENT_KEY_HERE
@zouppen
zouppen / README.md
Last active January 12, 2017 20:25
Ihmenetin VPN-skriptit

Skriptit Pupunettiä varten

Esimerkkiskriptit millä saadaan Pupunetin VPN soimaan.

Skripti tarvitaan siksi että vpnc:stä puuttuu uudelleenyhdistys.

Huom. Jos on tarvetta natata niin erityisen tärkeää on iptablesin OUTPUT-sääntö -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu, joka asettaa lähiverkosta tulevan MTU:n VPN:n MTU:ksi. Muuten yhteydet toimivat vähän huonosti. Lähde: