Live data from Hacker News

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

news.ycombinator.com

271–280 of 340 posts

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

#271
post #195

I run a clipboard logger + Window Title Logger in the background. I am able to find stuff from 10 years back. Works across all apps. Want to remember something just copy it. It might not be secure practice. I regularly encrypt the rolled over logs using 7z.

Would you mind sharing which tools you use or share the scripts? That sounds like a fantastic, no brainer way of saving stuff. I'm guessing there's a lot of noise too, like when you're editing code?

I was not saying complete truth. It records much more details. I use the my home made https://github.com/XEonAX/Kiilogger

At work I use autohotkey script that dumps clipboard to a text file with a timestamp.

I will see if i can get the code.

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

#272
post #271

Earlier quoted context omitted.

Would you mind sharing which tools you use or share the scripts? That sounds like a fantastic, no brainer way of saving stuff. I'm guessing there's a lot of noise too, like when you're editing code?

I was not saying complete truth. It records much more details. I use the my home made https://github.com/XEonAX/Kiilogger At work I use autohotkey script that dumps clipboard to a text file with a timestamp. I will see if i can get the code.

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
  return
  
  
  rload:
  Reload
  Sleep 1000 ; If successful,  the  reload will close this  instance  during the Sleep, so the  line  below will never be  reached.
  MsgBox, 4,, The script could  not  be reloaded. Would you like  to  open it for editing?
  IfMsgBox, Yes, Edit
  return

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

#273
I have a bunch of little scripts I use with my dwm installation. but the one I'm most proud of is a simple translation script where I type a phrase and it translates to my selected language and places it into my clipboard. Since I work in three languages, this really helps with day to day communication :D

``` #!/bin/bash

choice=$(echo -e 'pt -> es\nen -> es\nes -> pt\nes -> en' | dmenu)

text_to_translate=$(echo '> what to translate?' | dmenu)

[ "$choice" = 'pt -> es' ] && res=$(trans -no-warn --brief pt:es "$text_to_translate") [ "$choice" = 'en -> es' ] && res=$(trans -no-warn --brief en:es "$text_to_translate") [ "$choice" = 'es -> pt' ] && res=$(trans -no-warn --brief es:pt "$text_to_translate") [ "$choice" = 'es -> en' ] && res=$(trans -no-warn --brief es:en "$text_to_translate") [ "$choice" = 'pt -> en' ] && res=$(trans -no-warn --brief pt:en "$text_to_translate")

notify-send "traducão" "$res"

echo "$res" | xclip -selection clipboard ```

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

#274
post #272
post #271

Earlier quoted context omitted.

I was not saying complete truth. It records much more details. I use the my home made https://github.com/XEonAX/Kiilogger At work I use autohotkey script that dumps clipboard to a text file with a timestamp. I will see if i can get the code.

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.

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

#275

in 1995, I thought that it would be good if advertisements could be served from hubs to large numbers of web sites. That would mean that advertisers wouldn't have to hire ad space salespeople, which was far too expensive for most sites. But then there was the problem of how to decide which ads to show to which visitors to those sites. To do that, it seemed like it would be a good idea to base that decision on the sit…

Wow. Or, is this a wind up?

Wind up?

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

#276

Recently developed a small embedded device (using a nRF52840 microcontroller) that allows me to open my front gate remotely using my phone. I no longer have to carry around a gate remote. And my friends/guests can now open the gate from their phone as well. I couldn't find anything on the market for doing that so I'm glad I managed to do it (and it was a good opportunity to learn some embbedded programming and electr…

I have an app to open the gate of my parking garage. However, apps are not that convenient while driving. Reverse engineered it and created an Android Auto app instead. https://daanmiddendorp.com/tech/2022/10/13/reverse-engineeri...

Very nice. But I'm not sure my car has Android Auto, it is a bit old... I managed to integrate mine with Google Assistant on my phone so I say "Hey Google, turn on the front gate" (it thinks "front gate" is a switch).

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

#277
post #9

In 2004, the website All Music Guide did a horrible redesign. I was so irritated that I created a Firefox extension that did only one thing — it made All Music Guide a bit more useable. To my knowledge, this was the first "site-specific" browser extension, so I wrote a blog post about it: https://www.holovaty.com/writing/all-music-guide/ Aaron Boodman saw my post and decided to generalize the idea; he created Greasem…

Hah, well here's a thread to latch on to.

I'm pretty sure AllMusic was my source of track lengths for albums. Back in the middle of high school (so just before that redesign maybe?), I had some java utility that (I'm sure I'm imperfectly recalling) I pasted track information into. It then generated the Wikipedia markup equivalent, and I went around editing album pages on Wikipedia adding track lengths (and total album length).

And that's why I have something over 1000 wikipedia edits made a long time ago.

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

#278
I really don't understand how people can use git vimdiff in it's default form.

This is a script I made which can be invoked through "git difftool -d -x bettervimdiff" that opens each diff pair of changed files in a separate tab page. I acknowledge that it abuses tab page functionality a bit but I think it's pretty handy. Handles deletions, doesn't handle renames and symlinks yet.

https://gist.github.com/PhilipRoman/60066716b5fa09fcabfa6c95...

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

#280
As a junior dev in my first job I wrote a tiny script to format sql queries for a manual cumbersome process that runs every month. Almost 15 years later that script is still used and it carries my name. There might be one or two people left from that time, basically no one knows who does refer to. My legacy :)
Post reply on HN