Skip to content

Instantly share code, notes, and snippets.

View sorrell's full-sized avatar

Nick Sorrell sorrell

View GitHub Profile
@sorrell
sorrell / create-usb.sh
Last active January 2, 2024 15:23
Create Windows 11 USB boot disk
# List disks and update DISK_LOCATION to the correct disk
diskutil list
DISK_LOCATION="/dev/diskX"
DEVICE_NAME="WIN11"
ISO_LOCATION="$HOME/Downloads/Win11_23H2_English_x64.iso"
diskutil eraseDisk MS-DOS "$DEVICE_NAME" GPT $DISK_LOCATION
# Mount the ISO and copy the files to the USB
MOUNT_INFO=$(hdiutil mount $ISO_LOCATION)
@sorrell
sorrell / SidecarShortcut.md
Last active April 3, 2024 21:39
Activate Sidecar Shortcut

Sidecar Shortcut

This is a list of steps for creating a keyboard shortcut to activate Sidecar on macOS Ventura.

Steps

  1. Open Automator and create a new Quick Action
  2. Select Run AppleScript as the first and only step
  3. Input the below but be sure to replace "iPad New" with your device name
on run {input, parameters}	
	tell application "System Settings"
@sorrell
sorrell / validate_docker.sh
Created April 21, 2023 20:37
AGE smoketest for Docker
#!/bin/bash
# docker build . -t test-age:1.3.0
# docker run -d --rm --name testage -e POSTGRES_PASSWORD=pass test-age:1.3.0
# docker exec -it testage bash
apt-get update && \
apt-get install -y --no-install-recommends ca-certificates wget && \
GOSU_VERSION=1.12 && \
wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" && \
@sorrell
sorrell / validate.sh
Last active April 21, 2023 20:05
AGE smoketest
#!/bin/bash
# docker build . -t test-age:1.3.0
# docker run -d --rm --name testage -e POSTGRES_PASSWORD=pass test-age:1.3.0
# docker exec -it testage bash
# now in container which should be running PG
su postgres
# as postgres user
@sorrell
sorrell / run_test.py
Created February 2, 2022 21:43
Test MERGE direction in Neo4j
from neo4j import GraphDatabase
class TestDirection:
def __init__(self, uri, user, password):
self.driver = GraphDatabase.driver(uri, auth=(user, password))
def close(self):
self.driver.close()
@sorrell
sorrell / preparations.md
Created November 19, 2021 19:14 — forked from wholroyd/preparations.md
Getting Minikube on WSL2 Ubuntu working

Windows Preparation

  1. Ensure hypervisor functionality is enabled in BIOS.

    • I know it sounds stupid, but if you already have it enabled, disable it, restart the machine, and enable it again.
    • Otherwise you will hit microsoft/WSL#5363
  2. Launch a PowerShell prompt in Administrator mode [Win+X > Windows PowerShell (Admin)]

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
@sorrell
sorrell / provision.sh
Created August 19, 2020 18:11
provision osx
#!/bin/bash
# Utility functions
# Launch Daemons
# Disable Apple Push Notification Service daemon
# https://apple.stackexchange.com/questions/92214/how-to-disable-apple-push-notification-service-apsd-on-os-x-10-8
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.apsd.plist
@sorrell
sorrell / deoldify.sh
Created May 20, 2020 01:49
Run this on cmd line to add color to a BW file
curl $(curl \
-F 'image=@/home/user/myfile.jpg' \
-H 'api-key:<your-api-key>' \
https://api.deepai.org/api/colorizer | jq --raw-output '.output_url') > output-`date +%Y%M%d%H%m%S`.jpg
@sorrell
sorrell / cli_prompt_example.py
Created April 1, 2020 20:14
First hack at manim
from manimlib.imports import *
class makeText(Scene):
def createArrowAndDesc(self, mobj_next_to, desc, dir=UP):
arrow = Vector(direction=dir)
arrow.next_to(mobj_next_to, dir*-1)
desc = TextMobject(desc)
desc.next_to(arrow, dir*-1)
group = VGroup(arrow, desc)
@sorrell
sorrell / s3etag.sh
Created December 18, 2018 16:36 — forked from mleukering/s3etag.sh
A Bash script to compute ETag values for S3 multipart uploads on OS X.
#!/bin/bash
if [ $# -ne 2 ]; then
echo "Usage: $0 file partSizeInMb";
exit 0;
fi
file=$1
if [ ! -f "$file" ]; then