Skip to content

Instantly share code, notes, and snippets.

View sampollard's full-sized avatar

Sam Pollard sampollard

View GitHub Profile
@sampollard
sampollard / passport.sh
Created December 1, 2021 08:55
Get 6 2" x 2" passport photos on a 4x6
#!/bin/bash
# Create a 4x6 photo from one square image
if [ $# -ne 1 ]; then
echo "usage: ./passport.sh <filename>"
exit 1
fi
FN="$1"
montage "$FN" -clone 0,0,0,0,0 -geometry +0+0 -tile 3x2 "${FN%.*}-4x6.jpeg"
@sampollard
sampollard / conversation.sh
Created July 2, 2022 02:12
Slowly spit out text, paragraph by paragraph
#!/bin/bash
FILE=conversation
LTIME=`stat -c %Z $FILE`
# Below is a Text width of 40
echo "========================================"
while true
do
ATIME=`stat -c %Z $FILE`
if [[ "$ATIME" != "$LTIME" ]]
then
@sampollard
sampollard / merge.sh
Last active February 17, 2023 05:23
Merge pdfs
# usage: merge out.pdf file1.pdf file2.pdf ...
function merge() {
out="$1"
shift
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE="$out" -dBATCH $@
}
@sampollard
sampollard / capslock.ahk
Last active February 24, 2024 08:30
Add some convenience keybindings
; How to view scancodes in AHK v1 (I can't figure this out for v2)
; Right-click, "run this script" on this file (not the .exe)
; Right click and select "Open"
; View -> Key History and Script Info
; Now you can type things, press F5 to refresh; they appear bottom-up
SendMode("Input") ; Tutorials say this is good
Capslock::LCtrl ; Map Capslock to Control
RCtrl & Capslock::Capslock ; Map Right control + Capslock to Capslock
; Hibernate on ctrl+alt+win+h