Skip to content

Instantly share code, notes, and snippets.

View sigwinch28's full-sized avatar
🕶️
blem wit

Joe Harrison sigwinch28

🕶️
blem wit
View GitHub Profile
#!/bin/sh
echo ''
echo ' __________'
echo ' / ___ ___ \'
echo ' / / @ \/ @ \ \'
echo ' \ \___/\___/ /\'
echo ' \____\/____/||'
echo ' / /\\\\\//'
echo ' | |\\\\\\'
@sigwinch28
sigwinch28 / README.md
Last active January 4, 2021 21:07 — forked from jamesmacfie/README.md
iTerm 2 - script to change theme depending on Mac OS dark mode including change-on-start

How to use

In iTerm2, in the menu bar go to Scripts > Manage > New Python Script

Select Basic. Select Long-Running Daemon

Give the script a decent name (I chose auto_dark_mode.py)

Save and open the script in your editor of choice.

@sigwinch28
sigwinch28 / INSTALL.md
Created February 27, 2020 03:06
Installing FreeBSD using a separate boot device (SD card for booting SSD in ODD bay on HP Microserver, for example)

Assumptions

  1. You will be using the FreeBSD installer's automatic ZFS partitioning scheme
  2. Your boot filesystem is zfs:zroot/ROOT/default (the default with the installer)
  3. Your SD card is device da0

Instructions

@sigwinch28
sigwinch28 / text-to-qr.sh
Created January 9, 2020 23:38
QR code with label
#!/bin/sh
# Requirements: imagemagick (for `identify` and `convert`) and qrencode
TEXT="$1"
OUT_FILE="$2"
QR_IMG_FILE=$(mktemp --suffix=.png)
qrencode -s 6 -o "$QR_IMG_FILE" "$TEXT"
WIDTH=$(identify -format '%w' "$QR_IMG_FILE")
#!/usr/bin/env python3
from dataclasses import dataclass, field
from functools import reduce
from itertools import combinations
from math import gcd
from typing import List, Set
import copy
def lcm(denominators):
@sigwinch28
sigwinch28 / str.erl
Created April 24, 2018 21:16
Strings in Erlang
Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [kernel-poll:false]
Eshell V9.3 (abort with ^G)
1> str:print("Here's a hint").
Char: H
Char: e
Char: r
Char: e
Char: '
Char: s
@sigwinch28
sigwinch28 / discrep.erl
Created March 30, 2015 18:59
The weakness of success types.
-module(discrep).
-export([run/0]).
% example of where type annotations fail to perform as expected.
% running `dialyzer discrep.erl` will return something similar to:
%
% Checking whether the PLT /home/joe/.dialyzer_plt is up-to-date... yes
% Proceeding with analysis... done in 0m0.29s
% done (passed successfully)
%
[Unit]
Description=OpenVPN connection to %i
[Service]
Type=forking
ExecStart=/usr/bin/openvpn --cd /etc/openvpn --config /etc/openvpn/%i.conf --daemon openvpn@%i --writepid /run/openvpn@%i.pid
PIDFile=/run/openvpn@%i.pid
[Install]
WantedBy=multi-user.target
@sigwinch28
sigwinch28 / packer.log
Created November 27, 2014 20:02
Packer creation of archlinux image from scratch
[joe@ryuko packer-arch]$ time packer build arch64.json
virtualbox-iso output will be in this color.
==> virtualbox-iso: Downloading or copying ISO
virtualbox-iso: Downloading or copying: http://www.mirrorservice.org/sites/ftp.archlinux.org/iso/2014.11.01/archlinux-2014.11.01-dual.iso
==> virtualbox-iso: Starting HTTP server on port 8975
==> virtualbox-iso: Creating virtual machine...
==> virtualbox-iso: Creating hard drive...
==> virtualbox-iso: Creating forwarded port mapping for SSH (host port 3148)
==> virtualbox-iso: Starting the virtual machine...