Posts Tagged ‘TSA’

2012w25

Sunday, June 24th, 2012

Quite a while since I wrote a post now, I’ve not been sick or anything, but there has been a lot of work abound, and outside work I prioritized sleeping over writing. But now I’m back for the moment, so let’s get down to business :)

Since last time I’ve come up with new ways of abusing awk, such as having it find the highest value from a command outputting in the following syntax:

\t<characters, integers, fullstop>: <integer>\n

To make it a little more different, the command also spits out a header, as well as an additional newline after the end of output.

I just now, while writing this, came up with a different solution, which doesn’t use awk:

theCommand | grep -v '^[^ \t]\+' | tr -d ' ' | cut -d':' -f2 | sort -r | head -n 1

but what I ended up using was:

theCommand | awk 'BEGIN { highest = 0 } $0 ~ /^[ \t]/ { if ( $2 > highest ) { highest = $2 } } END { print highest }'

In this case, from what I can gather, awk is the more efficient solution. One process versus five.

Update: As Werner points out, the if statement isn’t really necessary (which also makes it possible to cut out the BEGIN statement as well):

theCommand | awk '/^[^ \t]/ && $2 > highest { highest = $2 } END { printf "%d\n", highest }'

Utilities

  • ditaa (a.k.a DIagrams Through Ascii Art) makes it easy to generate nice-looking diagram images from… rather nice-looking ASCII diagrams
  • docopt, a command-line interface description language, which also seems to support generating the parser for the CLI being described
  • Peity for generating different types of charts using jQuery and <canvas>
  • Ghost.py interacting with web pages, programmatically

As of late I have been thinking a great deal about backups and the project which seems the most interesting to me is Duplicity.

Random tech stuff

Other random not-so-techy stuff

What I pass for humour

:wq

2012w07

Sunday, February 19th, 2012

What I thought I’d do was I’d try some more tweaks, this one about categorization. Mostly because I think some of the neat things I’ve stumbled over in the past couple of weeks might not deserve their own heading. So I am revamping the headings:

Hacks

I thought this section would be about… not necessarily hacks, but if you would, the hacker mentality. Redefining a problem, is one such trait.

And building an eco-friendly house for around $5000 is defintively another.

Finally, Hacking Hacker News, which sounds like a rather fun project.

Tech

I’ve been meaning to learn wireshark, mostly because I could probably put it to pretty good use at work, and then I found pcap2msc which could probably be pretty useful for visualizing the collected data.

I also found a pretty useful site, Sleepyti.me which, given an average sleep cycle of 90 minutes, and user input when she wishes to wake up, calculates when the user should go to bed. Neat!

Commandline

I came across a very good explanation on how to use join.

I’ve also looked into how to increase trust in commits in git, namely by signing commits with your gpg key, and it turned out to be downright easy to accomplish.

Society

I guess that if we are completely ok with any potential ramifications of businesses keeping track of everything we buy, and speculating about what our purchases indicate, then it is completely ok to dispose of cash altogether. Personally it scares the willies out of me.

It’s funny how people seem to always confirm my concerns by abusing powers they shouldn’t have had in the first place…

I knew there was a I keep calling these guys the MAFIAA. Asshats…

While I understand this point and certainly agree to a certain degree, I maintain that if more people voted with their wallets, they’d soon run out of funds with which to buy new laws.

:wq