Skip to content

Instantly share code, notes, and snippets.

@vancluever
vancluever / amifind.sh
Created January 26, 2016 08:05
Find the most recent Ubuntu AMI using aws-cli (or any other AMI for that matter)
#!/bin/sh
# Use AWS CLI to get the most recent version of an AMI that
# matches certain criteria. Has obvious uses. Made possible via
# --query, --output text, and the fact that RFC3339 datetime
# fields are easily sortable.
export AWS_DEFAULT_REGION=us-east-1
aws ec2 describe-images \
@vancluever
vancluever / gnome-tracker-disable.md
Last active November 13, 2024 18:26
GNOME Tracker Disable

Disabling GNOME Tracker and Other Info

GNOME's tracker is a CPU and privacy hog. There's a pretty good case as to why it's neither useful nor necessary here: http://lduros.net/posts/tracker-sucks-thanks-tracker/

After discovering it chowing 2 cores, I decided to go about disabling it.

Directories

@vancluever
vancluever / macos-big-sur-ssh-agent-local-no-disable-sip.md
Last active November 6, 2024 09:02
Run SSH Agent w/Modified Options (MacOS Big Sur, No Homebrew, No SIP Modification)

Run SSH Agent w/Modified Options (MacOS Big Sur, No Homebrew, No SIP Modification)

The following will show you how you can modify the startup options of the SSH agent supplied by MacOS in a non-invasive way. This can be useful for doing things like setting a key lifetime, which can then be used with AddKeysToAgent in your ~/.ssh/config to automate the timing out of saved keys. This ensures that your passphrase is re-asked for periodically without having to shutdown, re-log, or having it actually persisted in keychain, the latter being almost as bad as having no passphrase at all, given that simply being logged in is generally enough to then use the key.

This method does not modify the system-installed SSH agent service (com.openssh.ssh-agent), but rather duplicates its functionality into a user-installed launch agent where we can then modify the options. Modifying the system-installed service is becoming increasingly harder to do; SIP generally protects

@vancluever
vancluever / ssh-agent.service
Created January 4, 2018 05:19
SSH agent systemd service
[Unit]
Description=OpenSSH Agent
[Service]
Type=simple
Environment=SSH_AUTH_SOCK="%t/ssh-agent.socket"
ExecStart=/usr/bin/ssh-agent -D -t 14400 -a "${SSH_AUTH_SOCK}"
[Install]
WantedBy=default.target
@vancluever
vancluever / kvm-vhost-vs-userspace.md
Created March 9, 2023 20:42
KVM vhost-net vs userspace networking

KVM - vhost-net vs Userspace Host CPU Performance Comparison

I've been kicking the tires recently on a new KVM server I'm using for a home lab, and one of the things I've been investigating recently is network optimization in the guest.

Being especially anal about it and during my investigation of whether or not I could reasonably fix an approximately 500usec latency difference between pinging the guest and host, I started to look into making sure vhost-net was enabled on my rudimentary and extremely minimal KVM host running Alpine Linux. After ultimately getting it set up and finding the same latency, I wanted to see where the real value laid with having this setup on what will ultimately still be a not-so-busy low-end machine. I found some interesting results!

TL;DR: at the very least, vhost-net will save you a decent amount of CPU. Read on!

The test setup

@vancluever
vancluever / verify.sh
Created January 24, 2023 01:50
MacOS Notarization Script
#!/usr/bin/env sh
spctl -a -vv "$1" && codesign --test-requirement="=notarized" --verify --verbose "$1" && codesign -dv --verbose=4 "$1"
@vancluever
vancluever / .envrc
Created December 15, 2022 02:37
Direnv for project node_modules
layout node
@vancluever
vancluever / tolower.sh
Created August 24, 2022 15:59
tolower alias
alias tolower='tr '\''[:upper:]'\'' '\''[:lower:]'\'''
@vancluever
vancluever / HOMEBREW-OLD.md
Last active February 28, 2022 18:01
Installing old versions of Homebrew packages
@vancluever
vancluever / lsnet.sh
Created June 9, 2021 17:59
List open network sockets using lsof on MacOS
#!/bin/sh
lsof -Pni