Skip to content

Instantly share code, notes, and snippets.

@drofmij
drofmij / git-cheat-sheet.md
Last active February 20, 2026 14:59
GIT Cheat Sheet for some harder things.

clone 1 branch just the newest version of files

git --single-branch --branch=${BRANCHNAME} --depth 1 ssh://git@${DOMAIN}/${DIR}/${REPO}.git clone

delete old branches THAT WERE PREVIOUSLY MERGED ONLY

git branch --merged | grep -v "\*\|default"|xargs -n 1 git branch -d

resurrect deleted branch

git checkout -b ${BRANCH} ${SHA OF REVISION TO RESSURRECT}

FIX LINE BREAKS

@drofmij
drofmij / cats3
Created September 19, 2022 13:25
download a file from s3 to /tmp, cat the contents, and delete the temp file
#!/bin/bash
BUCKET=$1
KEY=$2
EARL=${BUCKET}/${KEY}
NAME=$(md5 -q -s ${EARL})
aws s3 cp --quiet s3://${EARL} /tmp/${NAME}
from: https://forums.virtualbox.org/viewtopic.php?f=6&t=90233
probably not needed at all if you have extension pack installed on host but here it is.
VB_VM_NAME="YOUR_VM_NAME_HERE"
# Synchronize the time with the host every 60 seconds (Default 10 seconds)
VBoxManage guestproperty set "${VB_VM_NAME}" "/VirtualBox/GuestAdd/VBoxService/--timesync-interval" 60000
# Adjust in drift increments of 1 second (Default 100 milliseconds)
VBoxManage guestproperty set "${VB_VM_NAME}" "/VirtualBox/GuestAdd/VBoxService/--timesync-min-adjust" 1000
# Adjust if out of sync by more than 30 seconds (Default 20 minutes!)
@drofmij
drofmij / setup-octoprint.sh
Last active January 18, 2018 21:16
(WARNING: NOT FINISHED) Pi Zero W (armv6 / arm11) + Raspbian Stretch Lite + OctoPrint install script
#!/bin/bash
INSTALL_ROOT=~
OCTO_DIR=${INSTALL_ROOT}/OctoPrint
CURA_DIR=${OCTO_DIR}/cura
USER=pi
# WARNING: Work in progress not fully tested or scripted
cd ${INSTALL_ROOT}

How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.