Skip to content

Instantly share code, notes, and snippets.

View michaeldye's full-sized avatar

Michael Dye michaeldye

  • IBM Infrastructure
  • Salt Lake City, UT
View GitHub Profile
@michaeldye
michaeldye / arch-linux-install
Created April 2, 2023 19:10 — forked from jc00ke/arch-linux-install
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# This assumes a wifi only system...
Enable systemd-networkd debugging
mkdir -p /etc/systemd/system/systemd-networkd.service.d/
Create Drop-In /etc/systemd/system/systemd-networkd.service.d/10-debug.conf with following content:
[Service]
Environment=SYSTEMD_LOG_LEVEL=debug
And restart systemd-networkd service:
systemctl daemon-reload
@michaeldye
michaeldye / ngrok-selfhosting-setup.md
Created August 6, 2020 23:07 — forked from lyoshenka/ngrok-selfhosting-setup.md
How to setup Ngrok with a self-signed SSL cert

Intro

The plan is to create a pair of executables (ngrok and ngrokd) that are connected with a self-signed SSL cert. Since the client and server executables are paired, you won't be able to use any other ngrok to connect to this ngrokd, and vice versa.

DNS

Add two DNS records: one for the base domain and one for the wildcard domain. For example, if your base domain is domain.com, you'll need a record for that and for *.domain.com.

Different Operating Systems

@michaeldye
michaeldye / stat.js
Last active July 10, 2020 17:28
faust 2020 ctf stat
// setup: npm install node-fetch underscore
// invocation: (export TEAM_NAME='TTT'; export CSRF='CCC'; export SESSION='SSS'; node ./stat.js)
const fetch = require('node-fetch');
const _ = require('underscore');
// we get this from competition/status.json ; that's a useful page, perhaps we should combine data from each
const services = [
'mars-express',
'Cartography',
@michaeldye
michaeldye / rsync-backup.bash
Created March 20, 2020 16:45
A simple differential backup script that uses hard links to manage trees of filesystem backup deltas (heavy lifting done by rsync)
#!/bin/bash -x
# Backup scheme description
#
# This script is intended to prevent data loss from hardware failure or
# accidental deletion by performing regular (perhaps nightly) differential
# backups against a max period full backup (perhaps weekly).
#
# 0 is newest backup, largest number is the oldest. Script keeps 0 to
# (N-1) differential backups on system, Nth is a full. This script was tested
@michaeldye
michaeldye / prune-old
Created March 20, 2020 16:40
Prune oldest of files matching a "find" name pattern leaving NUM_KEEP on disk (useful for deleting old backups)
#!/bin/bash
#
# Note: Ignores files with ".part" suffix
#
NUM_KEEP=5
# example invocation: /usr/local/bin/prune-old /backup "gitlab-embedded-db*.dump"
@michaeldye
michaeldye / gitlab-backup
Created March 20, 2020 16:37
Gitlab CE backup ; assumes embedded Postgres DB
#!/bin/bash -ex
# also in a gist
/usr/local/bin/prune-old /backup "gitlab-etc-*.tar.gz"
/usr/bin/docker exec -t gitlab /bin/sh -c 'tar cvzf /backup/gitlab-etc-$(date -u +%s).tar.gz -C /etc ./gitlab'
/usr/local/bin/prune-old /backup "gitlab-embedded-db*.dump"
# with mounted /backup volume

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@michaeldye
michaeldye / newmail.py
Created February 23, 2018 00:11
Python IMAP mail notifier
#!/usr/bin/env python3
import easyimap
import re
import os
from dateutil.parser import parse
def message_summary(date, title, from_addr):
d = parse(date).strftime('%b %d %I:%M %p') if date is not None else '<unparsed>'
a = re.search('\<(.*)>', from_addr).groups()[0] if '<' in from_addr else from_addr
@michaeldye
michaeldye / keybase.md
Last active February 11, 2018 04:52
keybase proof

Keybase proof

I hereby claim:

  • I am michaeldye on github.
  • I am mdye (https://keybase.io/mdye) on keybase.
  • I have a public key ASDdIgwehQB44kwtOQcrPO8PBM2VWNHlQtBqukv_x597swo

To claim this, I am signing this object: