Live data from Hacker News

Show HN: now.sh

github.com

31–40 of 45 posts

Re: Show HN: now.sh

#31
post #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.

It does not actually parse the ifconfig output. On linux and freebsd it uses system calls to get the required information.

https://github.com/madx/moreutils/blob/master/ifdata.c

Re: Show HN: now.sh

#32
post #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

In the "Unix Programming Environment" book from 1984 there is an "overwrite" shell script depicted that does exactly this. I wonder why this never made it into the standard UNIX toolkit.

Re: Show HN: now.sh

#33
post #32
post #30

Earlier quoted context omitted.

> 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

In the "Unix Programming Environment" book from 1984 there is an "overwrite" shell script depicted that does exactly this. I wonder why this never made it into the standard UNIX toolkit.

I wonder why this never made it into...

That can be said for so many of these programs.

Re: Show HN: now.sh

#34

I'm not sure I really see a point in this. How are you going to forget the server's time zone when it's listed in the timestamps? It doesn't really make sense.

Some services, like squid have logs with the time in UTC seconds...

Re: Show HN: now.sh

#35
post #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.

Thank god for the Linux people innovating and replacing a perfectly functional tool that could be properly extended to add support for that configuration, and instead requiring people to learn yet another command.

It's about as bad as Solaris with their ifconfig/ipadm stuff and changing everything around so that configuration exists in multiple places and one tool doesn't handle the other. ipadm doesn't properly deal with /etc/. files and the two will conflict. Ugh.

Re: Show HN: now.sh

#36
post #22

Earlier quoted context omitted.

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.

Thank god for the Linux people innovating and replacing a perfectly functional tool that could be properly extended to add support for that configuration, and instead requiring people to learn yet another command. It's about as bad as Solaris with their ifconfig/ipadm stuff and changing everything around so that configuration exists in multiple places and one tool doesn't handle the other. ipadm doesn't properly deal…

Judging by the amount of righteous sarcasm dripping from your comment you clearly have no idea what ip is.

Re: Show HN: now.sh

#37
post #2

Two comments: 1) Really? This is on the front page of HN? 2) why aren't you printing to stderr?

One argument against using stderr: IIRC stdout defaults to line buffering (or more if piped), while stderr is flushed immediately, so using stderr vs. stdout can yield different results.

Re: Show HN: now.sh

#38
post #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

Just to be a smartarse ;):

    cat  output.txt
    some
    input
    EOF

Re: Show HN: now.sh

#39
post #38
post #30

Earlier quoted context omitted.

> 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

Just to be a smartarse ;): cat output.txt some input EOF

Maybe I'm missing it, but this doesn't seem applicable to what my sponge program (and joeyh's) are intended to do: to modify a file "in-place".

joeyh's example:

    sed "s/root/toor/" /etc/passwd | grep -v joey | sponge /etc/passwd
My example:

    sort 

Re: Show HN: now.sh

#40
post #39
post #38

Earlier quoted context omitted.

Just to be a smartarse ;): cat output.txt some input EOF

Maybe I'm missing it, but this doesn't seem applicable to what my sponge program (and joeyh's) are intended to do: to modify a file "in-place". joeyh's example: sed "s/root/toor/" /etc/passwd | grep -v joey | sponge /etc/passwd My example: sort

The whole point of a pipe is to have concurrent input and output. If so, and if you open the same file for input and output, you risk erasing the file by opening and deleting the file on the output side before reading it on the input side.

If the pipe is an unfulfilled promise (no concurrency) then there's no problem. But if the pipe does what it's designed to do, you will lose the file.

Post reply on HN