Skip to content

Instantly share code, notes, and snippets.

Martin Schmitt mschmitt

Block or report user

Report or block mschmitt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mschmitt
mschmitt / decode_base64_log
Created Oct 24, 2019
Decoder for a file/log that contains Base64-encoded words
View decode_base64_log
#!/usr/bin/perl -w
use strict;
use diagnostics;
use MIME::Base64;
# Decoder for a file/log that contains Base64-encoded words
binmode STDIN, ':utf8';
binmode STDOUT, ':utf8';
@mschmitt
mschmitt / Digispark_SysRQ.ino
Created Sep 15, 2019
Sketch for the Digispark to send REISUB emergency boot sequence to a Linux host.
View Digispark_SysRQ.ino
#include "DigiKeyboard.h"
// USB HID Scan code for SysRq
#define SYSRQ 0x46
#define LED 1
/*
Sketch for the Digispark to send REISUB emergency boot sequence
to a Linux host.
@mschmitt
mschmitt / condensepath.sh
Created Jun 29, 2019
shorten a given pathname by compressing all /paths/leading/to/pathname into single character /p/l/t/pathname
View condensepath.sh
#!/bin/bash
# shorten a given pathname by compressing all
# /paths/leading/to/pathname into single character /p/l/t/pathname
function condensepath {
local PATHNAME="$1"
local REGEX='(.*/)(.)[^/]+(/.+)'
# https://stackoverflow.com/a/22261454
while [[ "$PATHNAME" =~ $REGEX ]]
@mschmitt
mschmitt / myap.cgi
Last active Mar 30, 2019
CGI script to extract the client's currently used wifi access point from the Unifi Controller's RESTful API
View myap.cgi
#!/bin/bash
# https://ubntwiki.com/products/software/unifi-controller/api
UNIFI_BASE="https://localhost:8443"
UNIFI_USER="readonly"
UNIFI_PASS="password"
echo "content-type: text/plain; charset=utf-8"
echo "Refresh: 10"
@mschmitt
mschmitt / Alienware-m15.ahk
Created Mar 13, 2019
Alienware m15 Macro Key Mapping
View Alienware-m15.ahk
; Alienware-m15.ahk
;
; Map Alienware m15 Macro keys 1-4 to arbitrary keypresses, without
; the use of Alienware Control Center.
;
; Macro Key 1
SC112::
SendInput {F13}
return
View freebsd-updateall.sh
#!/bin/sh
echo /usr/sbin/freebsd-update --not-running-from-cron fetch
/usr/sbin/freebsd-update --not-running-from-cron fetch | cat
echo /usr/sbin/freebsd-update install
/usr/sbin/freebsd-update install | cat
echo /usr/sbin/pkg check
/usr/sbin/pkg check
@mschmitt
mschmitt / MIT LICENSE
Last active Mar 21, 2018 — forked from dmur/MIT LICENSE
Attractively wrapped 80-col MIT license
View MIT LICENSE
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
View stunnel.conf
pid=/var/run/stunnel-8443-ssh.pid
sslVersion=TLSv1
# decoy web service mail.example.com
[8443-ssh]
cert=/etc/tls/signed-cert.20141107.pem
key=/etc/tls/key.20130329.pem
accept=:::8443
connect=::1:80
@mschmitt
mschmitt / tohtml.sh
Created Jul 28, 2017
Convert any text file to syntax highlighted HTML
View tohtml.sh
#!/bin/sh
# Convert any text file to syntax highlighted HTML
vim -c TOhtml -c 'w' -c 'qa' "$1"
View gist:5ff9c25f1e403ec3dd890b8d44a37aba
perl -MIO::Socket::INET -e 'open I,"</etc/services";while(<I>){
(/^\s*($|#)/)&&next;($n,$p,@j)=split/\s+/;($p=~s/\/tcp//)||next;
$s=IO::Socket::INET->new(PeerAddr=>$ARGV[0], PeerPort=>$p,Proto=>'tcp')?
print"$n($p)-->Open\n":next}' 192.168.12.34
You can’t perform that action at this time.