It All Makes Sense Now

The blog of Mats Gefvert.

sed and awk Reference

Posted 10/10/2019

Argument Description
 
awk '{print $1}' Print 1st word from lines separated by space
awk -F: '{print $1}' Print 1st word from lines separated by colons
 
sed -n Don't display input lines in output
sed '5d' Delete line number 5
sed '5,10d' Delete lines 5-10
sed '5,$d' Delete lines from 5 until end-of-file
sed -n '5~2p' Print every other line from the 5th line
 
sed -n '/pattern/p' Print lines matching a regex pattern
sed '/pattern/d' Delete lines matching a regex pattern
sed 's/my/your/g' Substitute all (-g) "my" with "your"
sed 's/my/your/2' Substitute the...

Short Story: I'm So Sorry

Posted 9/6/2019 in Fiction

If you're reading this, let me just say that I'm sorry: So very, very sorry.

I didn't mean for any of this to happen. I'm beyond devastated for all of the lives lost - and the countless destruction it brought. I have no words to express my regret and shame for what I did. I can only hope that whatever is left of humanity will go on, and one day build a new and better world without the mistakes we did.

Yeah… I'm the guy who ended the world.


It all started as an experiment. It was just more of a trivial "what-if"...

Common TcpDump Parameters

Posted 9/4/2019 in Reference

Argument Description
 
Output
-A Print packet in ASCII
-e Print MAC address (link-level info)
-x Print packet in hex
--print Print parsed output even if saving packets to file
-w file Write raw packets to file
 
Options
-- -
-c count Capture count packets
-i interface Listen on interface
-n Don't resolve addresses
 
Filters
port nnn Filter traffic on port nnn
host name Filter on host name
ip host name Filter IP traffic on host name
tcp port 80 Filter TCP traffic on port 80

Common CURL Parameters

Posted 8/21/2019 in Reference

Argument Description
 
Protocols
--http1.0 Use HTTP 1.0
--http1.1 Use HTTP 1.1
--http2 Use HTTP 2
-4 Resolve domain names to IPv4
-6 Resolve domain names to IPv6
-k Allow insecure connections in SSL
 
HTTP options
--data ... HTTP POST data
--data-urlencode ... HTTP POST data ('@' allowed)
-F name=content Specify multipart MIME data
-G Put POST data in URL and use GET
-H header/@file Pass custom header to server
-m secs Maximum request time
--oauth2-bearer token Use OAuth2 bearer token
-u user:password Server user and password
--url URL to work with
  ...

My List of Ubiquitous Software

Posted 8/15/2019 in Reference

(Really just a list for myself when I reinstall a new computer.)

Productivity

Communication

  • Skype - but the Windows client, not the Win10 app
  • Slack - collaboration/chat client

Development

Common wget Parameters

Posted 7/31/2019 in Reference

Argument Description
 
-o Output file name
-nc No-clobber (don't overwrite anything)
-c Continue (add to existing file)
-N Only retrieve if newer than existing
-S Display server response
-nH Don't create host directories
--header=x Insert custom header
--save-headers Save headers to file
--referer=x Use custom referer
--method=x Use custom HTTP method
--post-data=STR Set POST data from string
--post-file=FILE Set POST data from file
-r Recursive
-l n Maximum recursion level
-k Convert links to local
-p Page requisites
-L Follow relative links only
-np No-parent (don't ascend into parent directory)

Just Like Riding a Bike

Posted 5/3/2019 in Reflections

I've always felt like national economy is kind of like riding a bike.

Remember back when people didn't have LED's or batteries, but just the plain old dynamo, that you put against the wheel, and the faster you went, the brighter the lights got?

Just like a wheel, the national economy spins around. Goods and services are being produced and consumed, and the money that pays for it is constantly shuffled around, from person to person - just like a big bike wheel. The faster it goes, the richer we all become. The slower it goes, the poorer we are. (This may...

Password Management Survey Results

Posted 4/16/2019 in Reflections

(Please scroll to the bottom to see a few simple password recommendations and guidelines.)

A week or two ago, I sent out a request on Facebook and LinkedIn for people to participate in my survey about password management. My interest was to see, given how complex passwords are becoming and how easy it really is to crack most passwords, how people on various technical levels approach password management.

I did get a handful of responses - not overwhelming by any means, but still enough to put together a survey result, which I think is interesting to analyze. The initial results...

Faith? Or Science? Or Both?

Posted 1/1/2019 in Christianity

I've always loved science.

Science, to me, represents the quest for understanding; the peeling back of the layers of our world and figuring out how it all works. It is the believe-nothing, question-everything-until-proven approach that demands hard evidence and rigid logic before it accepts anything, in its ongoing mission to seek out the truth. And, judging by the results, it seems to work pretty well. I like it a lot.

But here's the crux: I'm also a Christian, believing in a God that we cannot see nor measure. Anyone who has ever tried to prove the existence of God (and there have...

Gingerbread Christmas Tower

Posted 12/22/2018 in Poetry

Behold --

A stately tower now was made
With candy, frosting and decor;
Three ginger levels keenly laid
Upon another there did soar;
And the peak in brilliance alight
With candied decoration bright
Shone forth on white and frosted floor.
    Each level carefully aligned -
    A testament to bakery refined,
O, tower, harbinger of Christmastide,
Bring forth thy season glorified!