A shell wrapper script that uses awk to convert a delimited file (where delimiter can be any character) to HTML tables.
To export Chrome (or Chromium) browsing history on Linux in a more flexible format than what Settings > History displays, could extract it from the History file, which is an SQLite database.
I had a fresh Debian 7 (Wheezy) install on a new server. Some months later, on Dec 21 2013, ran "sudo apt-get update && sudo apt-get dist-upgrade", after reboot, system wouldn't boot, instead dropping me to a "grub> " prompt.
The specific use case is that I didn't have Postfix properly configured on some machine to send mail, and it was delivered locally to "/var/spool/mail/root". I fixed the problem by adding my actual email address in "/etc/aliases" such that mail sent to root will now be sent to my email, but would also like the old messages sent there as well.
For security, troubleshooting and client billing reasons went to turn on Varnish Cache logging today.
On Debian (should be the same in Ubuntu), with varnish 3.0.4 packages installed from repo.varnish-cache.org, it's all done in /etc/default/varnishncsa.
Uncommented VARNISHNCSA_ENABLED=1, added a custom LOG_FORMAT line with fields I wanted my logs to contain, using the varnishncsa manual page as my guide. Started up varnishncsa with sudo service varnishncsa start, only to find just the first field from my custom log format logged (remote host, or %h, in my case).
After all these years of managing crontab entries, I made an error the other day, causing a job to run on a wrong day. Oops.
I used to have a handy cheat sheet I'd insert at the top of /etc/crontab, but a while back stopped, thinking I've graduated past it. Clearly not, but my web searches for one didn't turn up any I liked. So made my own. Here it is in case anyone else needs handholding:
#+--------------- minute (0-59) #| +------------- hour (0-23) #| | +----------- day of month (1-31) #| | | +--------- month (1-12) #| | | | +------- day of week (0-7), 0=Sunday #| | | | | user command 17 * * * * root cd / && run-parts --report /etc/cron.hourly 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) 47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly ) 52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly ) # your custom jobs here...
Needed a way to tile web browser windows for a system monitoring thing I'm working on. Came across this great tool called wmctrl that allows programmatic control of application windows. Wrote a script to automate launching a bunch of separate Chromium web browser windows, then resize them and arrange in a grid. See also this post on launching multiple Chromium browser windows from the command line.
Here's a video of the script in action:
Working with characters that have special meanings is sometimes a pain. A handy workaround is to work with their octal (or hexadecimal) representations instead. Let's say I want to manipulate input that contains single and double quotes with tools like grep, tr, sed and awk.
To check a local cert:
c="/path/to/cert" openssl x509 -noout -dates -subject -issuer -in $c
To check a remote cert, first get it with s_client, then feed to x509:
h="google.com" p="443" openssl s_client -host $h -port $p | openssl x509 -noout -dates -subject -issuer
depth=1 C = US, O = Google Inc, CN = Google Internet Authority verify error:num=20:unable to get local issuer certificate verify return:0 notBefore=Aug 14 21:46:27 2013 GMT notAfter=Oct 31 23:59:59 2013 GMT subject= /C=US/ST=California/L=Mountain View/O=Google Inc/CN=*.google.com issuer= /C=US/O=Google Inc/CN=Google Internet Authority read:errno=0
I like to use separate Firefox profiles with different add-ons for different roles like general web browsing, development, proxying, etc. In older versions of Ubuntu (Gnome 2), one could just right click the Firefox app launcher to modify startup options (see Multiple isolated instances of Firefox within a single login session on Linux), but in more recent versions (Gnome 3 and Unity), the process is a little more involved. Here's what's been working for me in Ubuntu 12.04.