Live data from Hacker News

Ask HN: What small library or tool do you want that doesn’t exist?

news.ycombinator.com

81–90 of 145 posts

Re: Ask HN: What small library or tool do you want that doesn’t exist?

#81
post #6

Earlier quoted context omitted.

Get print the current time as as Unix timestamp. date +%s To convert a Unix timestamp to local time with GNU date, e.g. date -d @1651483224 With BSD date, e.g. date -r 1651483224

Yes, I can never remember that. It's faster to just go to some online tool than to look up how to convert timestamps with `date`. Especially since I often switch between Linux and "BSD" (macOS). Something like this would be nice: $ datez 1651483224 human-readable-timestamp $ datez human-readable-timestamp 1651483224

Had never thought of building such a tool, but now that you mention it, there were cases where I had Unix sitmestamps in log/debug files for instance. I ended up using the web browser console to do a quick conversion.

I just gave it a try now, as a shell script:

    #!/bin/sh
    # https://news.ycombinator.com/item?id=31233092
    
    case "$1" in
        -*|"")
            echo "Usage: datez "
            ;;
        *)
            if date -r "$1" 2>/dev/null; then date -r "$1"; else date -d "@$1"; fi
    esac
Edit: tried to add the reverse, from human-readable-timestamp to Unix timestamp, and got a problem when the locale does not use the English language: the human-readable form is not understood by date as input!

So the round-tripping version of the script has to set the locale to C:

    #!/bin/sh
    # https://news.ycombinator.com/item?id=31233092
    
    # Needed for round-tripping:
    export LANG=C
    
    case "${1}" in
        -*|"")
            echo "Usage: datez "
            ;;
        *)
            case "${1}" in
                (*[!0-9]*)
                    date -d "${1}" +"%s"
                    ;;
                (*)
                    if date -r "${1}" 2>/dev/null; then
                        date -r  "${1}"
                    else
                        date -d "@${1}"
                    fi
            esac
    esac
Edit 2: it does round-trip by using a locale-independent format like "%Y-%m-%d %H:%M:%S %Z", which is anyhow the format I prefer:

    #!/bin/sh
    # https://news.ycombinator.com/item?id=31233092
    
    # Needed for round-tripping if you use a locale-dependant format:
    #export LANG=C
    FORMAT="%Y-%m-%d %H:%M:%S %Z"
    
    case "${1}" in
        -*|"")
            echo "Usage: datez "
            ;;
        *)
            case "${1}" in
                (*[!0-9]*)
                    date -d "${1}" +"%s"
                    ;;
                (*)
                    if date -r "${1}" 2>/dev/null; then
                        date -r  "${1}" +"'${FORMAT}'"
                    else
                        date -d "@${1}" +"'${FORMAT}'"
                    fi
            esac
    esac

Re: Ask HN: What small library or tool do you want that doesn’t exist?

#82

A cross-platform command-line tool + C library with permissive license that makes compressed file-deduplicated snapshots of directories with accompanying indexed metadata. It should be foolproof, use a fast compression algorithm like snappy or LZO, and be optimized for fast multicore creation and extraction (but with optional CPU-limiting). Metadata could be stored in an sqlite database.

To what end? I think borg or restic would both match these criteria. Maybe you're hoping for something that does this more online and continuously?

I'm looking for something in-between a version control system and an archiver, with simple file-based deduplication and as fast and robust as possible. Maybe you can explain whether restic and borg fit my needs. Desired functionality:

- Main inputs are an input directory or a list of files, the location of a file repository (1 file), the location of a metadata DB, and some indexed and searchable metadata like original path, modification date, semantic version number, arbitrary title, and other strings.

- If an input file has been changed or is not yet stored, it is archived in the file repository compressed with very fast compression like snappy or LZO with corresponding metadata and version in the metadata DB. Otherwise only the metadata information is stored. Support for deltas / storing incremental changes in the file repository would also be nice but is not required.

- The metadata is stored in the metadata DB so later a file can be retrieved based on version information, it's original modification data, it's original path, and/or metadata regexp searches.

- Snapshots of an input directory or list of files can be extracted based on version information and any other metadata. Extraction needs to be very fast.

- The library needs to work on common file systems and at least on Linux, Windows, and MacOS.

- Archiving should be ACID-compliant. Either a file is stored with all of its metadata so that it is retrievable, or nothing is stored and an error is returned. Likewise for whole input directories and for extraction.

Re: Ask HN: What small library or tool do you want that doesn’t exist?

#83
post #80

A simple reddit client that de-dupes posts (across subs and over multiple sessions)

A first step could be to fully resolve cross-posts, then only display if the original hasn't already been shown in the feed. Then display a dropdown of sorts on the original post to reach hidden crossposts.

A second one could be to hash all the things and hide images/videos/... already viewed.

Both these have fundamental downsides. The comments are often the most interesting thing, and if you plan on interacting with them in any capacity, the specific subreddit is important, so hiding that randomly might be undesirable.

Re: Ask HN: What small library or tool do you want that doesn’t exist?

#85
post #80

A simple reddit client that de-dupes posts (across subs and over multiple sessions)

It would be nice if there were a multi- service client like a feed reader that organized by unique post and offered the conversations of each service as attributes to it.

Re: Ask HN: What small library or tool do you want that doesn’t exist?

#86
Structural regular expressions awk as described here: http://doc.cat-v.org/bell_labs/structural_regexps/se.pdf But maybe it is not that small...

I would like to have a simple app that would let me define a time, a beep sound and a pattern. So I could have a one beep timer [1] and an interval timer [2]. I use those for exercise, but I'm not entirely satisfied. Bonus points if the beep sound could be configurable to notification sounds, sfxr UI [3] (maybe it could be be another simple application) and speech synthesizer.

Something that would crawl GitHub and look for Android play store links in READMEs, then it would offer a search over repository name, description and the README. I would use this first to search for Android apps. I know about F-Droid, but I'm lazy and there are things in the play store that are not in F-Droid. Also it would be easier for me to find apps to recommend to my family/friends, who will not install F-Droid.

[1] https://play.google.com/store/apps/details?id=com.thrvg.beep... - like this, but without this introductory screen and single button to reset and restart the timer

[2] https://greggman.github.io/interval-timer/ - I use this, but I would just want to set a single parameter: time between beeps and let it play in a loop until I stop

[3] https://sfxr.me/

Re: Ask HN: What small library or tool do you want that doesn’t exist?

#87
post #85
post #80

A simple reddit client that de-dupes posts (across subs and over multiple sessions)

It would be nice if there were a multi- service client like a feed reader that organized by unique post and offered the conversations of each service as attributes to it.

Yeah that'd be really nice, some services like Feedly offer deduplication but I suspect that only applies to text - not images.

Re: Ask HN: What small library or tool do you want that doesn’t exist?

#88
The main thing that keeps me using Windows and not Linux is a tool to index folders and files from all my DVDs and external hard disks. It also accounts for total size of each folder and browse the archive.

I only use the search file/folder name feature, I don't even need any content indexing that this tool has. It just needs to scale to Terabytes size (like millions of files/folders) and optionally do de-duplication.

If you know such tool on Linux, it would really help me to be less dependent on Windows. Or maybe someone you can build such a tool on Linux. I tried to create my own tool in Java but it took too much DRAM to index the many files I have. This Win tool indexes all my files and folders in a file of 1-200MB and searches all in 10-30 seconds. No server/database in involved, just a standalone tool.

I share the tool just for reference. The tool didn't had any update for years, I hope the programmer is still alive and healthy. https://www.whereisit-soft.com/

Re: Ask HN: What small library or tool do you want that doesn’t exist?

#89
post #51

A very simple tool for transferring files between two computers. Linux Windows should just work, uPnP handling, etc - just a crazy simple way to transfer a file without setting up Dropbox, ftp servers or whatnot!

For files that are not private I use: https://btorrent.xyz/

People usually recommend https://file.pizza but it just doesn't work for me.

Now that I think about this it would be beautiful if there was something like stunnel but for NAT hole punching and what not. You would do:

  $ send-file FILE
  qk11c14pmq7maeod
  $
You would send the unique id (that could be also something that gives a QR code to scan or something like random words) over a separate channel. Then you would "receive-file qk11c14pmq7maeod" on the other end. It would be a simple binary that would be easy to embed and call through some pretty UI. Probably generation and scanning of those possible QR codes would have to be a part of the package. The problem would be who would finance servers needed for NAT traversal?

Re: Ask HN: What small library or tool do you want that doesn’t exist?

#90

I wish VLC, plex, video players in general had the ability to automatically sync subs to audio. ( automatically , not manually) We have the technology; everything we need to do this exists. It's just not done automatically, and when using slightly off-sync subs, you have to fiddle with sub timing for ages until you find the right sync. Even more so when the subtitles have different off-sync issues for the whole movie…

I use Bazarr to automate downloading of subtitles for my movies and TV shows, and it integrates subsync. Works 99% of the time, if it doesn't I find the subs for that particular series are consistently offsync by 1.0s which is easy to fix with decent media players.
Post reply on HN