I sometimes find myself wanting a Unix timestamp, or to convert one into a human-readable date, and usually it's simpler to go to an online tool than use time(1).
It might be nice to have a command line tool which can guess from the arguments what you want it to do. For example, if you run it with no arguments, it would output the current timestamp (to multiple levels of precision, listing the languages/platforms that typically use each one).
I always forget how to get a unixtime so I either load a repl or the manpage for date, but FreeBSD date -r 123 works to go to human time. date -u -r 123 if you want UTC.
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:
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 <unix-timestamp>"
;;
*)
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 <unix-timestamp|human-readable-timestamp>"
;;
*)
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 <unix-timestamp|human-readable-timestamp>"
;;
*)
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
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/episode.
And you need to do the manual thing so rarely, that you always forget that does the delay need to be positive or negative if the subtitles are fast. =)
And then VLC does this weird freeze thing to catch up that can't be aborted, so if you accidentally type an extra zero into delay, good luck waiting for that to stop haha. Usually faster to just restart the damn thing.
I think this is what the OP refers to with "fiddle around for ages". I know the problem not with subs, but when audio is off related to the image. And of course the problem is rare enough that I am never "in training", and have to find a remarkable spot first (e.g. door slam shut or a suitable spot in dialogue), then think about going backwards or forwards, guess the amount, etc. etc. :)
If the whole subtitle file is out of sync (e.g. every line is late 2s), one shortcut is all it takes. In that 1/10 case, you do need to 'fiddle around for ages', but given that all other options (e.g. SubtitleEdit[1]) are way more complicated and time consuming, mpv is all I could suggest. For the problem with audio and image being out-of-sync, I have no idea :)
For AV sync you can do this in the receiver (and some devices with e.g. Bluetooth support for speakers) because it's not really a problem with the source material (typically anyway) it's just something that does need tuning to the room & hardware.
Given our capabilities, it's really a straightforward thing to do. YouTube does it automatically (you drop in your script with the video, it auto-syncs everything).
It could even be done for when the language doesn't match, given an auto-translation pass and some heuristics.
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.
There are some dark corners where there are still differences but these are not in the "I just want to build a website"-level of complexity IME, and are more in the "I am building a large XXX,XXX lines-of-code enterprise SPA used for hours at a time for thousands of users as their primary job across varied OS and browser combinations" level of complexity. E.g. I recently had to debug how different browsers handle cookie eviction for more than 100 cookies under the same top-level domain. This is not the sort of issue you you face with a "I just want to build a website" problem.
I unknowingly relied on undefined behaviour in JavaScript Array.sort; worked fine/as expected in Firefox but then got bug reports that turned out to be Chrome/Safari.
Interesting - what were the details? I've never heard of this and rely on this feature all the time so please do share the reproduction so we can all benefit?
I use MS SQL Server a lot at work. I interact with instances via SSMS usually. I'd love a tool that would log to file every query that I execute. Including a customisable comment line with info including when it was run and the server/db it was run against.
I'd move to a command line tool, e.g. a sqlcmd variant or shell voodoo, if it could do that.
Try out JetBrains Datagrip (or any IDE that includes it), it’s much more flexible than SSMS. Not sure if this exact feature exists, but they have a plugin interface, maybe you can write one on your own.
AWS has their own crontab syntax, slightly different from regular Cron. But there is no validation tool before you submit something. It just rejects it. I want something like crontab.guru but for cloudwatch syntax. It's such a small usecase but it'd be great.
I say "almost" because Quartz Scheduler expressions have one additional field: seconds. And there are more than likely differences in how nontrivial expressions and corner cases are handled by different tools.
swizel - takes csv input, selects columns and arbitrarily selects output order
OPTIONS
change the field delimiter (default comma)
handle trimming whitespace per field (or an arbitrary set of chars, e.g. quotes)
ignore or transform a prefixed one-line header or comment (default #)
[bonus points] handle numeric fields (e.g. precision or float/int conversion)
OBLIGATORY
while all of this can already be done with a combination of cut, sed, tr and/or awk, it's a common task when working with columnar data and could be made more intuitive and less error prone. transforming columnar data mostly boils down to clean up and basic sanity checks. good karma on this one.
A library of person-to-person communication snippets for those of us on the spectrum like this tool https://news.ycombinator.com/item?id=31224996 but curated by well intentioned community.
I would suggest not using those ones by the way - most of them sound pretty passive aggressive to me (British) and no better (worse in some cases/contexts) than just being forthright.
"Geometry as a service". An API endpoint that takes a compact description of various 3d shapes and returns a GLTF file. I'd start by maybe wrapping the various tools from https://www.antiprism.com/ but there's scope to create a more friendly set of tools for generating generally useful simple meshes.
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.
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.
I would love a small conversion tool to read in medical imaging dicom files and output a volumetric vdb dataset. I've nearly written this on several occasions. Most, but not all, dicom files encode a 2d or a 3d scalar field and vdb files are the graphical effects industry standard format for those, usually used for fog, fire, or similar effects. They can also usually be converted to polygon meshes through a variety of algorithms.
The reason why I want to do this is because 3d tools for artists -- blender, cinema 4d and the like -- have a large amount of easy-to-use and highly complex tools for subsetting volumes and making things look pretty.
Most medical imaging software is the opposite of this. You cannot change the data and the tooling is intentionally limited. Mostly this is a very good thing. Sometimes, however, and particularly for complex anatomy or pathology from a patient, you really just want to make a beautiful image for a paper with an anatomical structure manually removed, highlighted, or coloured differently -- something that would be very easy in e.g. Blender. The fact that Blender is python-scriptable is also frankly amazing and it's natively cross-platform too.
The reason I have written a tool like this is entirely because both file formats are very complex with lots of edge cases -- e.g. most ultrasound dicoms are little more then a screenshot with a lot of metadata, UI overlay and all. It's a lot of work and fundamentally isn't my job (I'm a medical physicist and should be making images with novel physics, not making images look pretty for presentation purposes).
Thanks! It seems like a very simple problem, is there a python library for vdb file IO? If so, I can probably whip something up (in python) with relative ease.
I work in the medical software field by the way. I know all about the pains of dicom...
I was just setting up a new Mac the other day, only to be surprised that this is _still_ an issue. All I had was XCode and Homebrew - everything fell apart when I tried to install ansible.
There’s no solution. You gotta have a separate environment (e.g. a docker container) for each project. Each env has its own python version and requirements.txt
Not practical when you need something like ROS with rospy that needs to be global.
Python is putting its fingers in its ears singing "LALALALA USE A VENV" instead of fixing the damn ecosystem. Node and npm proved that a solution exists and it's doable.
Apt has the big brained move of uninstalling half your system if you try to reinstall a core dependency instead of just setting the dependant packages as disabled while it's missing or something, ffs.
I don't think it's possible if you use a global environment for everything, as different packages might have conflicting dependencies. The best way to solve it is to separate environments. I personally prefer conda as it's fairly easy to create environments of any python version.
The top of the list is an open-source library toolbox for higher-order spectral analysis including time-frequency in a compiled programming language (C, C++, D, Rust, etc) for real-time applications.
This is an example of an old third party higher-order spectral analysis toolbox in Matlab but now Matlab has built-in toolbox due to its increasing popularity in signal processing of communication, biosignal, etc [1],[2].
The next generation communication systems (e.g. WiFi 7, 6G) will probably utilize this form of signal analysis for higher bandwidth and efficient communication [3]. The modern biosignal analysis (ECG, EEG, etc) is already moving toward time-frequency analysis and to have an open-source real-time time-frequency toolbox will be a game changer [4].
[1]Higher-Order Spectral Analysis Toolbox for use with Matlab:
I wish I had a tool which measures the trend of every line code in my codebase in production, and shows me on IDE on the background of each line of code which code is mostly used (dark green background or such) and which code is barely used (in light green), and in gray unused code in production (based on the trend of last few months.
The benefits :
- I will understand during development which code is mission critical, and I should be careful with it, as well as invest more time in optimizing this code and document it better.
- I will understand what the customers do, which flows they use and which flows they avoid, so seeing code which I've developed recently but not used yet - will help me understanding that I'm wasting my time on writing unused features or we did not really understood the customers expectations.
- I will be able to cleanup dead code easily on the go.
It's like a theme park manager walking around in the park and watches which rides has long lines of people and which rides have no lines.. helps the manager understand where to put effort and which rides to remove / replace.
I would want something slightly different. I care a lot about how recently code has been changed. I usually don't care how much code is run in production, unless it isn't run at all, and then I care a lot. So:
Code that was changed within the last week: red
Code that was changed within the last month: yellow
Code that hasn't been changed in over a month: normal
Code that hasn't been touched in over a year: green
I really like the idea of a "code heatmap". I actually think this could be easily implemented in one scenario: Visual Studio Code Lens already has that information. Massaging it into a background color probably wouldn't be too difficult.
All you have to do is run a build with coverage enabled and then load the coverage data files into your IDE. At least Eclipse (with EclEmma) shows the results in a way that are pretty close to what you described. I'm sure other IDEs can do the same.
The only thing is that nobody does this on production, because of the performance impact and potentially increased risk.
I was looking for a tool to post video tweet threads. I couldn't find any so I built my own https://clippost.io/. Currently, its very basic tool to convert YouTube, Instagram, TikTok videos to twitter video tweet thread. If I get some users i will definitely add more features to it.
Thanks for posting this. I'm gonna start using it for my Youtube channel: Better Sheets. Been meaning to post more on Twitter from the YT channel and this looks so great!
A simple app (e.g. a wordpress plugin) that would load some nice elements of a web page above the fold ... then load the rest of the web page after ... something that would lower time to first byte, first contentful paint and time to interactive.
Something to convert from one date to other, but with timezone names used by humans. For example:
"today 17:00 Pacific in UTC" should be accepted.
There are other time zones too: I've seen "PDT", "Mountain", and so on.
The `date` tool doesn't always understand what those are. That's a bummer because neither do I, and that's why I need this tool.
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!
It is strange that most of these tools seem to involve sending your data half way around the world. Guess local doesn't pay?
I just use good old SMB/network sharing - it's not much harder than setting up some program on two devices. Works between Windows/Linux/Android, fast and good enough.
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?
144 comments
[ 3.4 ms ] story [ 219 ms ] threadIt might be nice to have a command line tool which can guess from the arguments what you want it to do. For example, if you run it with no arguments, it would output the current timestamp (to multiple levels of precision, listing the languages/platforms that typically use each one).
Create aliases?
I just gave it a try now, as a shell script:
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:
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: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/episode.
Video players wouldn't want that in their codebase, maybe if it was available as a C library.
It's very convenient when it does.
> Ctrl+Shift+Left and Ctrl+Shift+Right
> Adjust subtitle delay so that the next or previous subtitle is displayed now. This is especially useful to sync subtitles to audio.
This works in 9/10 cases. :)
----
[1]https://mpv.io/
---
[1] https://www.nikse.dk/subtitleedit
https://subsync.online/
Discussion on HN (4 months ago): https://news.ycombinator.com/item?id=29794153
Given our capabilities, it's really a straightforward thing to do. YouTube does it automatically (you drop in your script with the video, it auto-syncs everything).
It could even be done for when the language doesn't match, given an auto-translation pass and some heuristics.
- Firefox will render stuff wrong
- Safari will render stuff wrong and something will break
There are some dark corners where there are still differences but these are not in the "I just want to build a website"-level of complexity IME, and are more in the "I am building a large XXX,XXX lines-of-code enterprise SPA used for hours at a time for thousands of users as their primary job across varied OS and browser combinations" level of complexity. E.g. I recently had to debug how different browsers handle cookie eviction for more than 100 cookies under the same top-level domain. This is not the sort of issue you you face with a "I just want to build a website" problem.
Not just dark corners IMO.
FF:
Node: (Obviously that's a silly example because you'd just `.sort()`, I think I was doing `a.id < b.id` or something, but it's not a significant detail.)You can even reduce the reproduction to `[1,2].sort((a,b) => 1)`. Have fun..!
I'd move to a command line tool, e.g. a sqlcmd variant or shell voodoo, if it could do that.
They have a log already: https://intellij-support.jetbrains.com/hc/en-us/community/po...
At a quick glance, the syntax looks similar to the one used by Quartz Scheduler, so you can almost use this: https://freeformatter.com/cron-expression-generator-quartz.h...
I say "almost" because Quartz Scheduler expressions have one additional field: seconds. And there are more than likely differences in how nontrivial expressions and corner cases are handled by different tools.
- 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.
The reason why I want to do this is because 3d tools for artists -- blender, cinema 4d and the like -- have a large amount of easy-to-use and highly complex tools for subsetting volumes and making things look pretty.
Most medical imaging software is the opposite of this. You cannot change the data and the tooling is intentionally limited. Mostly this is a very good thing. Sometimes, however, and particularly for complex anatomy or pathology from a patient, you really just want to make a beautiful image for a paper with an anatomical structure manually removed, highlighted, or coloured differently -- something that would be very easy in e.g. Blender. The fact that Blender is python-scriptable is also frankly amazing and it's natively cross-platform too.
The reason I have written a tool like this is entirely because both file formats are very complex with lots of edge cases -- e.g. most ultrasound dicoms are little more then a screenshot with a lot of metadata, UI overlay and all. It's a lot of work and fundamentally isn't my job (I'm a medical physicist and should be making images with novel physics, not making images look pretty for presentation purposes).
It's not as mature as the dicom standard (which is very...mature) and they do change it occasionally, but it is stable.
[1] https://www.openvdb.org/documentation/ [2] https://academysoftwarefoundation.github.io/openvdb/ [3] https://github.com/AcademySoftwareFoundation/openvdb
I work in the medical software field by the way. I know all about the pains of dicom...
- In Visual Studio I want a tool that shows me show many "hops (calls)" a C# method is away from another method.
https://xkcd.com/1987/
Python is putting its fingers in its ears singing "LALALALA USE A VENV" instead of fixing the damn ecosystem. Node and npm proved that a solution exists and it's doable.
https://peps.python.org/pep-0582/
Unfortunately the PEP is from 2018 and is still being discussed. The last post in the comment thread is from February.
https://discuss.python.org/t/pep-582-python-local-packages-d...
That's unfortunate; until I went looking for citations I thought it was further along and actually scheduled for the next Python release.
Looks like there is a pip-alternative that implements the PEP, but I haven't played around with it yet.
https://pdm.fming.dev/
(though the usual way it breaks is your python interpreter gets updated and the venv becomes useless)
This is an example of an old third party higher-order spectral analysis toolbox in Matlab but now Matlab has built-in toolbox due to its increasing popularity in signal processing of communication, biosignal, etc [1],[2].
The next generation communication systems (e.g. WiFi 7, 6G) will probably utilize this form of signal analysis for higher bandwidth and efficient communication [3]. The modern biosignal analysis (ECG, EEG, etc) is already moving toward time-frequency analysis and to have an open-source real-time time-frequency toolbox will be a game changer [4].
[1]Higher-Order Spectral Analysis Toolbox for use with Matlab:
https://labcit.ligo.caltech.edu/~rana/mat/HOSA/HOSA.PDF
[2]Time-Frequency Foundations of Communications:Concepts and Tools:
https://www.mins.ee.ethz.ch/pubs/files/SPMAG2013.pdf
[3]The OTFS Interview – Implications of a 6G Candidate Technology:
https://www.6gworld.com/exclusives/the-otfs-interview-implic...
[4]Analyzing Neural Time Series Data: Theory and Practice:
https://mitpress.mit.edu/books/analyzing-neural-time-series-...
The benefits :
- I will understand during development which code is mission critical, and I should be careful with it, as well as invest more time in optimizing this code and document it better.
- I will understand what the customers do, which flows they use and which flows they avoid, so seeing code which I've developed recently but not used yet - will help me understanding that I'm wasting my time on writing unused features or we did not really understood the customers expectations.
- I will be able to cleanup dead code easily on the go.
It's like a theme park manager walking around in the park and watches which rides has long lines of people and which rides have no lines.. helps the manager understand where to put effort and which rides to remove / replace.
Code that was changed within the last week: red
Code that was changed within the last month: yellow
Code that hasn't been changed in over a month: normal
Code that hasn't been touched in over a year: green
Dead code: blink tag, DOOM music plays
https://docs.microsoft.com/en-us/visualstudio/ide/find-code-...
All you have to do is run a build with coverage enabled and then load the coverage data files into your IDE. At least Eclipse (with EclEmma) shows the results in a way that are pretty close to what you described. I'm sure other IDEs can do the same.
The only thing is that nobody does this on production, because of the performance impact and potentially increased risk.
I'm well aware of the performance impact on production, I guess it's the major challenge here.
Since I'm mainly developing in python - here's a good article about that, he gave some directions to make it faster: https://www.drmaciver.com/2017/09/python-coverage-could-be-f...
"today 17:00 Pacific in UTC" should be accepted.
There are other time zones too: I've seen "PDT", "Mountain", and so on. The `date` tool doesn't always understand what those are. That's a bummer because neither do I, and that's why I need this tool.
/ You already mentioned it.
I just use good old SMB/network sharing - it's not much harder than setting up some program on two devices. Works between Windows/Linux/Android, fast and good enough.
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:
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?