It All Makes Sense Now

The blog of Mats Gefvert.

Docker Reference

Posted 11/13/2019 in Reference

Command/option Description
 
Containers Containers are light-weight virtual machines
docker create image [cmd] Create container from image
docker run image [cmd] Create container and run
-a pipe Attach container to pipe (e.g. cat file.txt | docker run -i -a stdin ...)'
-d Detach into background and print container ID
-e var Expose local environment variable to the container
-e var=value Set environment variable in the container
--env-file filename Set environment variable in the container from key=value file
-h hostname Set hostname
-i Interactive
--name name Set name
-p 80:5000 Bind container port 5000 to host port...

sed and awk Reference

Posted 10/10/2019 in Reference

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...

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)

Windows CMD reference

Posted 8/25/2018 in Reference

ATTRIB [/s] [/d]

Changes file attributes. /s makes it recursive, /d makes it operate on directories as well. I didn't know about these switches before. Handy.

CALL :label arguments

Neither did I know you could call a label in a batch file. This should make it easier to write "gosub"-like routines. And the parameters can be expanded with new interesting features, see below. To exit from the subroutine, use the "goto :eof" statement.

CHKNTFS

Schedule a check-disk on next boot. Might come in handy sometime.

EXIT /b [errorlevel]

Exits the command shell. If you use the /b switch, exits the current batch file....

Common ffmpeg parameters

Posted 6/24/2011 in Reference

Argument Description
 
Information
-codecs Display codecs
-formats Display formats
-f fmt Force format "fmt"
-i filename Set input file name
-y Overwrite output file
-t secs Force duration to specific length (hh:mm:ss[.xxx])
-fs limit Set file size limit
-ss secs Seek to given time position (hh:mm:ss[.xxx])
-target type Specify target type ("vcd", "svcd", "dvd", "dv", "dv50", "pal-vcd" etc); all format options are set automatically
 
Video
-b bitrate Video bitrate in bps
-r fps Set frame rate (default 25)
-s WxH Set frame size (default same as source)
-vf scale=W:H Rescale video (use...