Ask HN: Small scripts, hacks and automations you're proud of?
281–290 of 340 posts
Re: Ask HN: Small scripts, hacks and automations you're proud of?
#282I use the following tiny script to make PDFs look like they have been scanned. There are still entities that require you to physically sign a document and scan it. So far, everyone accepted PDFs like these: #!/bin/sh ROTATION=$(shuf -n 1 -e '-' '')$(shuf -n 1 -e $(seq 0.05 .5)) convert -density 150 $1 \ -linear-stretch '1.5%x2%' \ -rotate ${ROTATION} \ -attenuate '0.01' \ +noise Multiplicative \ -colorspace 'gray' $2
Do you have a before and after of a sample pdf? Sounds great. How do you use it? I don't see any PDF file paths?
./script.sh original.pdf scanned.pdfRe: Ask HN: Small scripts, hacks and automations you're proud of?
#283Sometimes on another computer I would think "what was that URL again..?" and just SSH into that computer and execute the command.
[1]: https://github.com/bergheim/dotfiles/blob/a525b216c7404a4332...
Re: Ask HN: Small scripts, hacks and automations you're proud of?
#284It replaces common ASCII characters by their typographic counterpart, e.g. "Hello - I'm back" will get "Hello — I'm back"
Re: Ask HN: Small scripts, hacks and automations you're proud of?
#285Getting transaction data from banks is hard. Especially timely data. Luckily both my banks have the option for a notification email being sent immediately after each Visa or checking account transaction. Using n8n I can parse those emails and put the data into a nice Airtable base (and a csv for backup). Next step, is to add GPS co-ordinates to each transaction. Does anyone know if there is a way to run a secure and…
Re: Ask HN: Small scripts, hacks and automations you're proud of?
#286Re: Ask HN: Small scripts, hacks and automations you're proud of?
#287Re: Ask HN: Small scripts, hacks and automations you're proud of?
#288This was a recursive `rm -rf node_modules` that turned into a rust learning project and got out of hand :) now supports 14 different languages/project types. https://github.com/tbillington/kondo .
Re: Ask HN: Small scripts, hacks and automations you're proud of?
#289Most useful script I've ever written, and legitimately how I keep track of everything important in my life: #! /bin/bash function todo { if [ $# -eq 0 ] then vim ~/Dropbox/todo/todo_list.txt else vim "$HOME/Dropbox/todo/todo_list_$1.txt" fi } Sourcing this in my shell means I just have to type... todo To automatically get into my default todo list which is synced to dropbox (and thus accessible everywhere on mobile a…
# Append a timestamped entry to the journal
log() {
printf "$(date +%Y-%m-%d--%H:%M) %s\n" "$*" >> $journal
}
# Query the journal
lquery() {
grep -ni $1 $journal
}
# Show all journal entries from today
ltoday() {
clear
grep -n $(date +%Y-%m-%d) $journal
}
# On a line identified by line number, switch @todo to @done
ldo() {
sed -i "$1 s/@todo/@done/" $journal
sed -i "$1 s/$/ \[COMPLETED $(date +%Y-%m-%d--%H:%M)\]/" $journal
}
Nice things about this system: there's only one file; I'm only ever looking at the data I want to see; and there are no applications running or files open (except my terminal, I guess).Re: Ask HN: Small scripts, hacks and automations you're proud of?
#290Earlier quoted context omitted.
Autohotkey script starts from below line #Persistent SetTimer, rload, 3600000 firstrun:=true return OnClipboardChange: if (firstrun=true) Goto, CONSECRUN Sleep,500 curclip:=clipboard Sleep,500 if oldclip %curclip% FIleAppend, `r`n=============================== =======`r`n%A_DD%-%A_MMM%- %A_YYYY%: :%A_Hour%:%A_Min%: %A_Sec%`r`n%Clipboard%, %A_ComputerName%Tracker.clip oldclip:=clipboard CONSECRUN: firstrun:=false ret…
It needs to reload regularly coz sometimes it gets stuck. Also might lock the clipboard of too much office document is copied.