Skip to content

Instantly share code, notes, and snippets.

View MatthewJohn's full-sized avatar
👽
ಠ_ಠ

Matt John MatthewJohn

👽
ಠ_ಠ
View GitHub Profile
@MatthewJohn
MatthewJohn / zip_md5.py
Last active February 6, 2024 07:38
Generate MD5 Checksums of files within a zip file
import sys
import os
import zipfile
import hashlib
if len(sys.argv) != 2:
raise Exception('Usage: ./zip_checksum.py <zip file>')
zip_file_path = sys.argv[1]
@MatthewJohn
MatthewJohn / generate_releases.sh
Created February 3, 2024 10:59
Automatically generate github releases for pre-existing releases
# Re-requisites:
# Install gh (https://cli.github.com/manual/) and login
cd /to/repo
# NOTE: Github appeared to set each release as "latest" when it created it.
# Afterwards, I just set the correct release to latest.
# All releases were shown in the correct order (though release date was the current date)
for tag in $(git tag)
do
if gh release list | grep -E "\s${tag}\s"
@MatthewJohn
MatthewJohn / aws_batch_cron_with_command_args.tf
Created September 5, 2019 06:17
Trigger AWS batch via cloudwatch cron with custom command
resource "aws_batch_job_definition" "batch_job_definition" {
name = "batch_job_defintion"
type = "container"
# Provide job definition JSON with placeholders for overrides.
container_properties = <<EOF
{
"image": "mycontainer:latest",
"memory": 128,
"vcpus": 1,
@MatthewJohn
MatthewJohn / README.md
Created July 15, 2019 09:53 — forked from int128/README.md
GitLab SAML SSO with Keycloak

GitLab SAML SSO with Keycloak

Keycloak

  1. Open your Keycloak realm.
  2. Import keycloak-gitlab.json.
  3. Fix URLs of the client.

GitLab

@MatthewJohn
MatthewJohn / prune_dir.sh
Last active February 21, 2019 12:33
One-liner prune oldest file to reach disk percentage free
#!/bin/bash
export WANTED_PERC_FREE=92 DEL_DIR=./ MAX_DELETIONS=10; for i in $(find ${DEL_DIR} -type f -printf "%TY%Tj %p\n" | sort -n | gawk '{ print $2 }' | head --lines=$MAX_DELETIONS); do if (( $(df ${DEL_DIR} --output=pcent | tail -1 | sed 's/[^0-9]//g') > $WANTED_PERC_FREE )); then rm $i; else exit 1; fi; done
### Keybase proof
I hereby claim:
* I am MatthewJohn on github.
* I am matthewjohn (https://keybase.io/matthewjohn) on keybase.
* I have a public key whose fingerprint is 1436 F32B 11C3 D4C9 FEB6 C648 03D7 E916 1EC2 D65D
To claim this, I am signing this object:
resource mcvirt_vm-vm-name-disk-1
{
on node1
{
device /dev/drbd2;
disk /dev/node1/mcvirt_vm-vm-name-disk-1-drbd-raw;
address 1.2.3.3:7790;
flexible-meta-disk /dev/node1/mcvirt_vm-vm-name-disk-1-drbd-meta;
}
on node2
@MatthewJohn
MatthewJohn / MCVirt live migration test
Created June 11, 2015 11:13
MCVirt live migration test
Index: source/etc/libvirt/hooks/qemu
===================================================================
--- source/etc/libvirt/hooks/qemu (revision 0)
+++ source/etc/libvirt/hooks/qemu (working copy)
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+
+# Example arguments:
+# dest: test-vm3 migrate begin -