Lurker News
Curious to know if anyone has written programs for their own, regular, & personal use. And if so what they are? E.g. A colleague of mine tracks all of his homes energy use through a custom program which disaggregates the energy consumption per device and outputs a report to a tablet.

Comments (651) 385 threads

LeoPanthera10 replies#
Hundreds! Doesn't everyone? Most of them are just bash scripts, many of which have now reached a complexity so high that I wish I'd started writing them in a different language but it's too late now. The majority of the rest are Python.

Off the top of my head, the most used ones are:
* A replacement front-end for "tar" and various compressors
* A script to synchronize my music library to a compressed version for playing in my car
* A secure-but-readable password generator
* A system to batch compress folders full of video files. (For ripped blu-ray discs, mostly.)
* A replacement front-end for "ffmpeg", see above
* A "sanity check" program for my internet connection to see if the problem is me, or Comcast
* A front-end for "rm" that shows a progress bar when deleting thousands of files. (Deletes on ZFS are unusually slow.)
And lots more tiny things.

pdonis3 replies#
> Hundreds! Doesn't everyone?

I certainly have. Interestingly, one was the same "sanity check" program for my internet connection, because of the same ISP you mention. Amazing coincidence...I don't think. :-)

tessierashpool2 replies#
I've written one too, if you count a simple shell alias for ping google.com

Comcast "service" has probably driven the creation of more trivial internet connection test programs than any college course in the world.

oblib#
I get more calls from users of my apps that have Comcast as the access provider than any other, and by far. The first thing I do when they have connection issues is check downdetector.com
OrderlyTiamat#
Mine uses notify-send to send a notification when connection is back up/ when connection goes down.
brk2 replies#
Add another Comcast outage checker and logger to the pile. Used to call and hassle them for outage refunds regularly.
inetknght1 reply#
Chalk me up to that too. And my brother. Originally I'd used Ping Plotter. When I went 100% Linux I stopped using that. My brother ended up putting together a Grafana board tied to influxdb & infping and monitors several friend and family internet connections complete with alerts.

Here [0] is a screenshot of the Comcast cable connection from a year and a half ago. I have since switched to AT&T gigabit fiber. Here [1] is a screenshot from today.
[0]: https://knightoftheinter.net/img/20201102143900.png
[1]: https://knightoftheinter.net/img/Screenshot_20220413_171934....

Continue this thread — 1 reply

ahmedalsudani#
Hah. I did not realize that was an option. Should have been keeping track of downtime :)
mauvehaus1 reply#
I ginned up a "wait for the internet to come back up" script that repeatedly pinged something with one packet, and used the Mac 'open' command to play an mp3 file once the ping succeeded. Unsexy, but when you can't google up a better solution...
ralgozino1 reply#
I made something similar but I used macos' `say` command instead :)

Continue this thread — 1 reply

parentheses#
Links, please.
edpenz9 replies#
> A secure-but-readable password generator

I love pronounceable passwords, but there's research indicating that such generators typically produce lower than expected entropy. Do you mind sharing what algorithm you use?

heyoni2 replies#
Problem is so many websites have these arbitrarily low password lengths that usually max out at 20 characters.

Continue this thread — 2 replies

Jaruzel4 replies#
For ages I remembered this as 'battery-horse-staple-correct' but then I see loads of people saying 'correct-battery-horse-staple' so now I think I'm the one who is wrong.

I wonder which way round is actually the right way to say it?

Continue this thread — 4 replies

wiredfool1 reply#
I gave up on readable.

    with open('/dev/urandom', 'rb') as f:
        return base64.urlsafe_b64encode(f.read(12))
lobocinza7 replies#
alias genpwd="tr -dc 'a-zA-Z0-9!@#$%*()[]{}' < /dev/urandom | fold -w 16 | head -n 1 | xclip -sel clip"

Continue this thread — 7 replies

stirfish3 replies#
Something like

    cat /usr/share/dict | shuf -n 4 | tr '\n' '-'
(inb4 unnecessary use of `cat`)
lucb1e2 replies#
I posted some advice in a sibling thread, <https://news.ycombinator.com/item?id=31021503>, that applies here as well:

> Please don't use $RANDOM or $((RANDOM)) or standard `shuf` for password generation. These RNGs are not cryptographically secure. Use input from /dev/urandom instead.

Continue this thread — 2 replies

jmholla1 reply#
I use cat like this all the time. It means I can easily change whatever program I'm using to interact with the program (e.g. switching `tr` to `sed`).

Continue this thread — 1 reply

slowbdotro1 reply#
Not OP, but I prefer memorable passwords, thus, correct-battery-horse-staple style passwords in bash: (Install cracklib, or any dict file)

  #!/bin/bash
  pickaword() {
        WORDFREQFILE=/usr/share/dict/cracklib-small;
        WORDLENGTH=$1;
        awk -v wordlength="$WORDLENGTH" 'length($1) == wordlength {print $1}' "$WORDFREQFILE"|shuf|head -n 1;

    }
  [[ ! -z $1 ]] && numWords=$1 || numWords=4
  separator="-"
  count=0
  currentWord=""
  while [[ $count -lt $numWords ]]; do
    [[ $count != 0 ]] && echo -n $separator
    num=$((3 + RANDOM % 10))
    word=$(pickaword $num)
    echo -n "$word"
    count=$(($count + 1));
  done
  echo ""
Edit: code formatting is hard. Source is: https://gitea.slowb.ro/ticoombs/dotfiles/src/branch/main/bin...
lucb1e2 replies#
Please don't use $RANDOM or $((RANDOM)) or standard `shuf` for password generation. These RNGs are not cryptographically secure. Use input from /dev/urandom instead.

Modulo operations like these are another thing to avoid. To get equal chances for each word, the simplest thing to do is e.g.

    do
      wordlistlength = 10e3
      randomnumber = os.urandom(1) * 256 + os.urandom(1)
    while randomnumber > wordlistlength
    return wordlist[randomnumber]
(Adjust if your list length is greater than 255×256+256, of course.)

Further, I see that cracklib-small is 52k words. That's not good or bad, but it makes the default 4-word phrase 52e3⁴ ~ 63 bits of entropy, which isn't terrible but in my opinion on the short side as a default. It will be perfectly fine if you only ever want to defend against online attacks, but in some cases (think disk encryption or password manager) offline cracking should be kept in mind and for the rest you should usually use a password manager anyhow (so then memorability doesn't matter).
Or perhaps more succinctly: please don't roll your own crypto.
I understand that this is of course very unlikely to be abused if it's just for yourself and nobody knows of this weakness in your credentials (security through obscurity works... until it doesn't), but one day someone will use this as inspiration or it will spread somehow, say through an HN comment... just use good password generators or at least keep insecure ones secret.
Btw: many standard Debian(-based) installations have /usr/share/dict/words available so you don't need an extra install; I haven't seen cracklib used before but that might just be me.

Continue this thread — 2 replies

lobocinza2 replies#
Sometimes I use passages from books. Easy to remember a >60 char password, can always check the book and it brings back to memory a book that I enjoyed each time I use it. For PINs I like to use a long sequence of digits of a physical/mathematical constant.
rozab3 replies#
From books? Having anything that's natural language will kill your entropy, way way below correct horse battery staple. Moreso if it's indexed by Google Ngrams.

Continue this thread — 3 replies

Continue this thread — 1 more reply

Continue this thread — 4 more replies

Continue this thread — 7 more replies

jonplackett5 replies#
Yes. And it’s a strange one.

I made a program to gender swap any text you put into it and then got a book deal to rewrite and illustrate Fairy Tales. It’s been published around the world.
https://genderswappedfairytales.com
The idea is to shine a light on the original versions but it also creates a lot of never-written-before characters. A lot of brave princesses and lady-beasts, but also men desperately wanting children and being rewarded for kindness.
I wrote the gender swap algorithm in Swift. It seemed like it would just be a simple auto replace type thing when I started but there’s some weird things in English, for example with his/him/her/hers where they don’t swap back and forth sensibly and you have to understand the context.
It was his > it was hers.
It was his sword > it was her sword
So I ended up down this rabbit hole of natural language processing to break up each sentence into verbs, nouns etc to work out the correct words to use. Even tried training an AI to do it based on the finished swapped text but a whole bunch of rules worked more reliably.

KMag#
Those who don't know history are doomed to repeat medireview mistakes.

(I'm old enough to remember when Yahoo's attempt at preventing cross-site scripting, blindly replacing eval with review, resulted in such shenanigans as "Please reviewuate my CV for Professor of Medireview History". Some of the corruptions persisted outside of Yahoo mail when people emailed text to themselves as a form of file transfer. Yes, this went into production in one of the two largest email providers at the time.)

HellsMaddy1 reply#
People need to stop thinking this bot was a serious attempt. It is very obviously a troll making fun of people who advocate for gender neutral phrasing.
sn9#
Poe's Law strikes again.
conductr1 reply#
Sounds like an interesting challenge although I’ll admit on this one I would have just went to fiver and hired someone to edit the existing text. My guess is under and week and a couple hundred bucks at most and you’d be set.
tailspin20191 reply#
I think this is a case of "chop your wood and it will warm you twice"... ie. the value derived from this exercise was not just from the outcome, but also the journey there!
conductr1 reply#
Totally agree and get it, I do it selectively as well - and on this one, I don't think I would have enjoyed the challenge of it so I would have just outsourced the work to be done manually. It's such a straight forward thing to explain to someone else, I think most gig workers that spoke english reasonably well could quickly knock it out. Actually, so much so that since most of these stories are fairly short and you probably end up proofreading them dozen of times as you tweak the code and/or review the outsourced work for accuracy/completion... so I might have just done it myself manually and it would have taken probably less than a dozen hours without the communication overhead of going through fiver or similar. It's more of a do things that don't scale approach I suppose as myself with a toddler that loves reading stories I value my time above all else and could find a dozen more interesting things to hack on in my limited free time (highly subjective I know, just my hot take on the topic at hand).

Continue this thread — 1 reply

HellsMaddy1 reply#
This is so cool! I think I'm going to gift your book to my niblings next Christmas. Thank you for sharing!
jonplackett#
Thank so much! I hope you enjoy
jonplackett#
This is great, thanks - this was actually my initial idea and it sat there in my head for 5 years and then morphed into doing a book.

We’re doing a sequel this year and I’m going to redo the website with the aim of turning genderswapping into a movement and getting other people to join in. I’ll link this this for sure!

camgunz1 reply#
Wow this book is beautiful! Thank you for sharing.

Continue this thread — 1 reply

vax42512 replies#
I made myself a Chrome extension called Headlamp that puts a red dot by each link, button, text box, etc., and clears them as I click or type while I’m testing a web app.

When I hand off a build to a client, if all the red dots are gone, I know I’ve at least TOUCHED everything.
If I’m working with another engineer, we can both see the dots in our browser and collaborate to clear them all while we test.

Continue this thread — 12 replies

primitivesuave12 replies#
I created a program that prints QR codes onto sheets of peel-and-stick labels. When someone scans the code, they are directed to a simple web app that manages food sharing with my four roommates.

We noticed that we buy a lot of the same things (bananas, avocados, eggs, etc), so we implemented a system where anyone can stick a QR code onto something they want to share, and anyone else can scan it to record what they took. For example, this morning I pulled a carton of eggs out of the fridge, scanned it, recorded that I took 3, and a Splitwise expense was automatically updated between me and the person who bought the eggs (much easier and less awkward than handing someone 75 cents). Everyone is logged into the application via Splitwise OAuth, and all products/expenses/debts are automatically simplified within Splitwise and updated via the API - so the app is pretty much a wrapper over Splitwise specifically for granular sharing of food.

Continue this thread — 12 replies

Load more comments