Skip to content

Instantly share code, notes, and snippets.

View Maffsie's full-sized avatar
🌈
howdy

Matthew Connelly Maffsie

🌈
howdy
View GitHub Profile
@Maffsie
Maffsie / install-alpine.sh
Last active August 10, 2022 23:27
Hetzner-centric Alpine Linux provisioning script
#!/bin/sh
IPADDR=`ifconfig eth0 | grep 'inet ' | awk '{print $2}'`
IP6ADDR=`ifconfig eth0 | grep 'inet6 ' | awk '{print $2}' | grep -v '^f'`
DFROUTE=`route -n | grep '^0.0.0.0' | awk '{print $2}'`
DF6ROUTE="fe80::1"
IPSUB="27"
IP6SUB="64"
WORKDIR=`mktemp -d`
cd $WORKDIR

Keybase proof

I hereby claim:

  • I am maffsie on github.
  • I am maff (https://keybase.io/maff) on keybase.
  • I have a public key ASCXiK_qU92k-kmyN87x2Xpu-ZfNb0af5b8_X8g8xZfT7Qo

To claim this, I am signing this object:

#include <Wire.h>
#include <I2C_LCD.h>
/*
* ArduinoNano I2C_LCD
* GND <-> GND
* 5V <-> 5V
* A4 <-> SDA
* A5 <-> SCL
* By virtue of this being an I2C display, only two pins (aside from power) are needed

Keybase proof

I hereby claim:

  • I am Maffsie on github.
  • I am maff (https://keybase.io/maff) on keybase.
  • I have a public key whose fingerprint is 174B D339 05B9 BDF0 E392 C0DB 7B8A 457D 282B 7CB6

To claim this, I am signing this object:

class Ayudantelobo < Formula
homepage "https://github.com/MaffC/ayudante-lobo"
url "https://github.com/MaffC/ayudante-lobo/archive/v0.9.4.tar.gz"
sha256 "06fc0b51789862a50bec02791aba1d007dcbb87c78a3d2fe9295fcf910c3db70"
head "https://github.com/MaffC/ayudante-lobo.git"
depends_on "cpanminus"
depends_on "libssh2"
# depends_on "Net::SSH2" => :perl
# depends_on "POE" => :perl
POE::Session->create( inline_states => { _start => sub {
foreach my $monitor (keys $Conf->{monitor}) {
$_[HEAP]->{$monitor} = POE::Component::DirWatch->new(
alias => $monitor,
directory => $Conf->{monitor}->{$monitor}->{dir},
filter => sub { filter($monitor,$_);},
file_callback => sub { trigger($monitor,$_);},
interval => $Conf->{monitor}->{$monitor}->{poll},
);
}
@Maffsie
Maffsie / sshfp.sh
Created January 17, 2015 15:27
generate SSHFP records
ssh-keyscan -t dsa,rsa,ecdsa hostname 2>/dev/null|perl -MMIME::Base64 -MDigest::SHA=sha1_hex,sha256_hex -lane 'sub k2fp {my $k=shift;$k=decode_base64($k);return (sha1_hex($k),sha256_hex($k));};my ($h,$t,$f)=@F;$t=1 if $t eq "ssh-dss";$t=2 if $t eq "ssh-rsa";$t=3 if $t eq "ecdsa-sha2-nistp256";my ($s1,$s256)=k2fp $f;print "$h. 86400 IN SSHFP $t 1 $s1";print "$h. 86400 IN SSHFP $t 2 $s256";'

Keybase proof

I hereby claim:

  • I am maffc on github.
  • I am maff (https://keybase.io/maff) on keybase.
  • I have a public key whose fingerprint is 174B D339 05B9 BDF0 E392 C0DB 7B8A 457D 282B 7CB6

To claim this, I am signing this object:

IF="eth0.2"
_proto() { grep -Ei "^$1 " /etc/protocols|awk '{print $2}'; }
_prio() { iseq $1 highest&&echo 10;iseq $1 high&&echo 15;iseq $1 bulk&&echo 20;iseq $1 low&&echo 30; }
_tc() { /usr/sbin/tc $@; }
_qdisc() { act=$1;shift;_tc qdisc $act dev $IF $@; }
_add_qdisc() { _qdisc add $@; }
_add_class() { par=$1;cid=$2;shift 2;_tc class add dev $IF parent $par classid $cid $@; }
_add_filter() { dst=$1;shift;_tc filter add dev $IF protocol ip parent 1:0 prio 1 u32 match $@ flowid 1:$dst; }
iseq() { [ "$1" == "$2" ];return $?; }
clean() { _qdisc del root >/dev/null 2>&1;_qdisc del ingress >/dev/null 2>&1; }
#!/usr/bin/env bash
IFUP="/sbin/ifup"
IFDN="/sbin/ifdown"
PING="/bin/ping"
WLAN="wlan0"
PNGA="-c 1 -I $WLAN -W 1"
PNGT="94.23.194.120"
PNGF="8.8.8.8"
PNGR="192.168.0.1"
ITRA=0