Skip to content

Instantly share code, notes, and snippets.

@mtfurlan
mtfurlan / ip-script.Dockerfile
Created May 10, 2024 17:50
docker run script when vpn container ip changes
FROM alpine:latest
# gluetun doens't support post vpn up scripts
# this will cron and run a script on change, at most once every hour
# TODO: confirm that it's not once every 2 cause it runs once every 1,
# but bash script also has a too recent check
# use this like:
# ip_bullshit:
# network_mode: service:vpn
@mtfurlan
mtfurlan / 0008-patch-allmailfrom.patch
Created June 22, 2023 19:48
nullmailer debian patch
Description: allmailfrom modifies header now
https://github.com/bruceg/nullmailer/pull/84
Author: Mark <mark@fur.land>
Index: nullmailer-2.2/doc/nullmailer-inject.1
===================================================================
--- nullmailer-2.2.orig/doc/nullmailer-inject.1
+++ nullmailer-2.2/doc/nullmailer-inject.1
@@ -218,6 +218,10 @@ to queue the formatted message.
When reading the following files, a single line is read and stripped
of all leading and trailing whitespace characters.
#!/bin/bash
set -euo pipefail
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
set +e
read -r -d '' backups <<'EOF'
[
{ "src": "/home/mark/sync" },
{ "src": "/home/mark/projects" },
{ "src": "/home/mark/beatSaber" },
@mtfurlan
mtfurlan / hexDump.c
Last active October 13, 2022 20:12
c function to emulate xxd -g1
#include <ctype.h>
// based on https://stackoverflow.com/q/54500648/2423187
void hexDump(const uint8_t* data, int len)
{
int i;
unsigned char bufferLine[17];
for (i = 0; i < len; i++) {
if ((i % 16) == 0) {
[
"cigar",
"rebut",
"sissy",
"humph",
"awake",
"blush",
"focal",
"evade",
"naval",
@mtfurlan
mtfurlan / google authenticator codes
Last active August 30, 2021 20:13
read google authenitcator database and generate codes
#!/usr/bin/env python3
# read google authenticator database and output TOTP codes.
# /data/data/com.google.android.apps.authenticator2/databases/databases
#import qrcode
import sqlite3
import pyotp
from tabulate import tabulate
conn = sqlite3.connect('databases')
@mtfurlan
mtfurlan / googleDriveList.js
Created February 14, 2021 22:41
List out all files in a google drive folder
/**
* List out all files in a google drive to a spreadsheet.
* You have to modify the filter stuff at line 15 because it will
* timeout eventually before it's done, so you have to target what you list.
*
* When you download the spreadsheet as csv it has \r\n
*
* cat file.csv | dos2unix | xargs -d '\n' -L1 rm -f
**/
#!/bin/bash
set -euo pipefail
cd $(dirname "$0")
# to get auth key go to
# https://developers.google.com/calendar/v3/reference/events/list?apix_params=%7B%22calendarId%22%3A%22i3detroit.org_188da54r5a9rejlbnsedft642ok0m%40resource.calendar.google.com%22%2C%22maxResults%22%3A5000%7D
# open console
# select api key auth only
# make request
@mtfurlan
mtfurlan / read lines.sh
Last active July 27, 2020 01:31
Bash read line loop
#!/bin/bash
historyDir=/tmp/historyTest
function handle() {
echo "now run '$1'"
}
function cleanup() {
history -w $historyDir/$UID
}
@mtfurlan
mtfurlan / plot-hpgl-gpib.pl
Created July 17, 2020 15:07
send HPGL to plotter over GPIB
#!/usr/bin/env perl
# Send HPGL to plotter
#
# Unrelated curious marc video on pen adapter https://youtu.be/h-oj4HrTH14?t=471
use strict;
use warnings;
use LinuxGpib;
use Getopt::Std;