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

Show all comments

Showing thread 1 of 385

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