Live data from Hacker News

Ask HN: Small scripts, hacks and automations you're proud of?

news.ycombinator.com

281–290 of 340 posts

Re: Ask HN: Small scripts, hacks and automations you're proud of?

#282
post #196

I 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?

The first argument is the input file and the second one the output:

  ./script.sh original.pdf scanned.pdf

Re: Ask HN: Small scripts, hacks and automations you're proud of?

#283
Years and years ago I wrote chrome and firefox history commands [1]. Not proud of it, but it is more useful than I thought they would be, because well, they all want you to use google, so local search sucks. Easy to integrate with rofi, emacs etc.

Sometimes 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?

#285
post #42

Getting 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…

You can use Shortcuts app to send messages with current location to yourself

Re: Ask HN: Small scripts, hacks and automations you're proud of?

#286
I have a 10 line C# script which manages my notes. It's pinned to my Start menu. When I run it, it ensures an .md file for the current day is created in the folder for the current day, which is in the folder for the current month, which is in my notes folder, then opens VSCode on my notes folder with today's file focused. This is the bare minimum note structure which I can then break out into multiple files or move things to long-running folders as needed. VSCode is an excellent note taking tool in general, with extensions such as draw.io support or auto pasting images into Markdown.

Re: Ask HN: Small scripts, hacks and automations you're proud of?

#288

This 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 .

Nice! Beeen looking for something like this for elixir

Re: Ask HN: Small scripts, hacks and automations you're proud of?

#289

Most 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…

Similar. I've ended up at these functions in .bashrc:

   # 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?

#290
post #274
post #272

Earlier 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.

Thank you for sharing!
Post reply on HN