Live data from Hacker News

Show HN: now.sh

github.com

21–30 of 45 posts

Re: Show HN: now.sh

#21
post #18

Speaking of date/time stuff, is there anything that would convert to the current time zone? e.g. echo "03/Mar/2013 01:16:52 +0000" | mytz => 02/Mar/2013 17:16:52 -0800

$ date -d "Sun Mar 3 18:05:17 UTC 2013"

Sun Mar 3 10:05:17 PST 2013

The above converts to the system TZ. Or:

$ echo $( export TZ=CST; date -d "Sun Mar 3 18:05:17 UTC 2013" )

Sun Mar 3 18:05:17 CST 2013

The above converts from any TZ to any other TZ, without resetting your shell's TZ variable.

Re: Show HN: now.sh

#22
post #9

Another alternative is 'ts' which is part of joey hess's awesome collection of unix tools, moreutils.[1] I did not find out about ts until too late so I am still in the habit of using tai64n from djb's daemontools, which adds a tai64 timestamp to every file[2] and then tai64nlocal[3] in order to convert the timestamps to something useful to humans. If you don't know about moreutils check out the collection. I don't k…

One slightly off-topic note:

> ifdata: get network interface info without parsing ifconfi

If it's Linux, ifconfig isn't maintained anymore and might actually be lying (eg, virtual IPs on vlans on bonded NICs - sounds exotic but almost every trading house uses this config). Use the 'ip' command for most things you would have done with 'ifconfig'.

If it's BSD, ignore that and ifconfig away.

Re: Show HN: now.sh

#23
post #21
post #18

Speaking of date/time stuff, is there anything that would convert to the current time zone? e.g. echo "03/Mar/2013 01:16:52 +0000" | mytz => 02/Mar/2013 17:16:52 -0800

$ date -d "Sun Mar 3 18:05:17 UTC 2013" Sun Mar 3 10:05:17 PST 2013 The above converts to the system TZ. Or: $ echo $( export TZ=CST; date -d "Sun Mar 3 18:05:17 UTC 2013" ) Sun Mar 3 18:05:17 CST 2013 The above converts from any TZ to any other TZ, without resetting your shell's TZ variable.

You can also use:

$ TZ=CST date -d "Sun Mar 3 18:05:17 UTC 2013"

Sun Mar 3 18:05:17 CST 2013

which doesn't invoke a subshell. env vars can always be prepended to the executable name for use with just that program (not sure if that's bash only, though).

Re: Show HN: now.sh

#24
post #9

Another alternative is 'ts' which is part of joey hess's awesome collection of unix tools, moreutils.[1] I did not find out about ts until too late so I am still in the habit of using tai64n from djb's daemontools, which adds a tai64 timestamp to every file[2] and then tai64nlocal[3] in order to convert the timestamps to something useful to humans. If you don't know about moreutils check out the collection. I don't k…

I love pee

Re: Show HN: now.sh

#25
For an alternative way of accomplishing the example given take a look at multitail [1]. Hitting return will insert a line with the current date and time to the file you're tailing.

It also colour codes the output and allows you to tail multiple files simultaneously.

[1] http://www.vanheusden.com/multitail/

Re: Show HN: now.sh

#28
That was funny seeing this here, for a minute I thought someone had posted the now.sh from my dotfiles. But I think it's no longer there. In any case mine wasn't as thoughtful, it was just a shell script to pretty print the current time, so that I could index it with Gnome-do/Kupfer/Synapse and easily call it from there. But I have since moved that responsibility to a key binding in vim, since I'm always inside the editor. All this, of course, so that I could hide the Linux Mint bar on the bottom and still see the time easily through another mean.

Re: Show HN: now.sh

#30
post #9

Another alternative is 'ts' which is part of joey hess's awesome collection of unix tools, moreutils.[1] I did not find out about ts until too late so I am still in the habit of using tai64n from djb's daemontools, which adds a tai64 timestamp to every file[2] and then tai64nlocal[3] in order to convert the timestamps to something useful to humans. If you don't know about moreutils check out the collection. I don't k…

> sponge: soak up standard input and write to a file

Whoa! No kidding? I wrote a program years ago, probably around 2005, also called sponge, that does exactly this[1].

I'm not sure how to feel about this. Obviously the idea was a good one, but it's equally obvious I suck at getting the word out about my creations.

[1] https://github.com/graue/graue-utils/blob/master/sponge.c

Post reply on HN