Skip to content

Instantly share code, notes, and snippets.

View mikeblum's full-sized avatar
🥝

Michael Blum mikeblum

🥝
View GitHub Profile
@mikeblum
mikeblum / windows-iso-on-mac.sh
Created August 21, 2023 17:56
Build Windows 11 Live USB On Mac
diskutil list
diskutil eraseDisk MS-DOS "WIN11" GPT /dev/disk4
hdiutil mount ~/Downloads/Win11_22H2_EnglishInternational_x64v2.iso
rsync -vha --exclude=sources/install.wim /Volumes/CCCOMA_X64FRE_EN-US_DV9/* /Volumes/WIN11
ll /Volumes
@mikeblum
mikeblum / pi-hole.nomad
Created December 11, 2021 23:45
Pi-hole on Nomad
job "pi-hole" {
datacenters = ["homelab"]
type = "system"
constraint {
attribute = "${attr.kernel.name}"
value = "linux"
}
constraint {
@mikeblum
mikeblum / postgres_queries_and_commands.sql
Created April 17, 2021 16:05 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@mikeblum
mikeblum / xkcd.cypher
Last active October 3, 2020 19:42
Import XKCD Into Neo4j
CALL apoc.periodic.commit("
OPTIONAL MATCH (current:Xkcd) WITH current ORDER BY current.id DESC LIMIT 1
OPTIONAL MATCH (oldest:Xkcd) WITH current, oldest ORDER BY oldest.id ASC LIMIT 1
WITH current.id AS current_issue,
CASE
WHEN oldest IS NULL THEN 1
WHEN oldest.id = 1 THEN current.id END
AS oldest_issue, 'https://xkcd.com/info.0.json' AS uri
CALL apoc.load.jsonParams(uri, null, null)
YIELD value WITH value.num AS latest_issue, current_issue, oldest_issue
.bd-callout {
padding: 1.25rem;
margin-top: 1.25rem;
margin-bottom: 1.25rem;
border: 1px solid #eee;
border-left-width: .25rem;
border-radius: .25rem
}
.bd-callout h4 {
@mikeblum
mikeblum / deploy.sh
Created July 4, 2017 01:09
Deploying a Hugo blog to S3
#!/bin/bash
export S3_BUCKET=
# clean public build dir
rm -rf public
# rebuild site
hugo
# destructively sync with S3 bucket
# (anything not mirrored on the local filesystem will be deleted)
aws s3 sync public/ s3://$S3_BUCKET/ --delete
@mikeblum
mikeblum / authors.py
Created March 17, 2017 14:30
Create an authors.txt file for migrating from SVN to GIT using svn2git
import argparse
import subprocess
import sys
def main():
'''
Parse all SVN authors from the repository and append the specified domain
'''
parser = argparse.ArgumentParser(description='Collate all SVN comitters / authors with an email address.')
parser.add_argument('-domain', metavar='-d', help='e.x. tsgrp.com')
@mikeblum
mikeblum / Vagrantfile
Created January 30, 2017 15:47
Clustered RabbitMQ installation
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
# config.vm.box = "bento/ubuntu-16.04"
config.vm.box = "ubuntu/trusty64"
# RabbitMQ ports
config.vm.network :forwarded_port, guest: 5672, host: 5672
config.vm.network :forwarded_port, guest: 5673, host: 5673
@mikeblum
mikeblum / logger.py
Last active October 4, 2016 22:24
My goto Python logging template - lints 10/10 in pylint
#!/usr/bin/env python
"""
Global Python log configuration settings
@author mblum
"""
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
@mikeblum
mikeblum / sizeChecker.java
Created September 8, 2016 20:26
Calculate the size of an InputStream
package size_checker;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
public class SizeChecker {