I recently looked into RRDtool again. I realized that everytime I do I end up writing some scripts to create, update and generate graphs just so I can test stuff out.
For example, if I want to graph some temperature metrics I want to create a database, fill it with some mock up data and create some graphs. It's my RRDtool development cycle so to speak.
So this time I wrote three bash scripts to do just this. They are commented and are easy to modify depending on my needs.More →
One of my laptops was still running Linux Mint 16, also known as Petra, and an upgrade was long overdue. This post documents the process I used.
Note: I don't guarantee anything. Linux Mint is a binary dist based on another binary dist (Ubuntu) based on yet another binary dist (Debian). If the upgrade fails you are on your own.
The following steps is needed:
Ever needed to download hundreds of images and run them through OCR to get plain text out of it?
Curl has this nice feature to be able to express ranges in URLs. The images I needed to fetch was numbered so insted of writing a loop in bash and iterating I could just do something like this:
$ curl -O http://example.net/img[1-800].png
Then I simply iterated over each recieved file feeding it to Tesseract:
$ for f in $(ls img*.png); do tesseract $f $(echo $f | cut -d'.' -f1) -l swe; done
This produced a nice bunch of text files with the same as the image scanned and with the suffix txt.
Of course I could have done it all in the shell loop but it's nice to know the tools you use and for just fetching a bunch of URLs it's easier and more readable than creating a tiny shell script.More →
This is a little gem I found out when I changed my PS1 expression to include a counter for my todo list items in my prompt.
t to organize my tasks and took the PS1 suggested on the site:
export PS1="[$(t | wc -l | sed -e's/ *//')] $PS1"
I soon found out that it only gets evaluated once when bash starts. The trick, it turns out, is to escape $ so that it gets interpreted literally when bash starts but then gets used as expression when PS1 is re-evaluated:
export PS1="[\$(t | wc -l | sed -e's/ *//')] $PS1"
So this, the tiniest possible change, got me a nice, live, task count showing in my prompt. A nice reminder that I still have work to do.More →
The concept of pipes in Unix is very powerful. If we combine pipes with tar and ssh we have a simple and secure way of transfering files. It might not be the best way but these are tools that are available on almost any Unix system and it does have some advantages such as not using any space on the source system.
From a host you are currently logged on to:
$ tar zcf - source | ssh user@host 'tar zxf -'
From a remote host:
$ ssh user@host 'tar zcf - source' | tar zxf -
Some short notes on how to install MonoGame on Ubuntu based Linux with as little effort as possible.
sudo apt-get install mono-complete sudo apt-get install monodevelop-monogame
This should install everything, and then some, to get started exploring MonoGame.
Mono on Linux doesn't trust any SSL certificates by default. Resolve this by importing Mozilla's list of trusted certificates to avoid confusing errors later on:
mozroots --import --sync
If running into trouble trying to start MonoDevelop try to start without redirecting stdout/stderr:
Why it gets redirected by default is beyond me since failing without any information to the user is not very helpful. Fail early and fail loudly is a useful rule of thumb and hiding error messages are just bad.
Some quick notes on unit testing and testing ASP.NET MVC projects.
The environment and tools used:
Just for fun I wanted to make some notes about how to compile a simple C program in Windows from the command line with the minimal of extras to install. If you go looking on the web almost all answers to the question "how do I compile a C program on windows?" is either to download and install Visual Studio Express for Windows (the free version of Visual Studio), to use MinGW or to get Cygwin.More →
A while back I watched the talk More Instantly Better Vim by Damian Conway from OSCON 2013.
There were a lot of interesting Vim stuff in that talk and the talk it self was entertaining (go watch it).
One of the things I took away from the talk was enhanced hlsearch. When there's a lot of matches it can be kind of hard to see what occurence you just jumped to. This snippet makes the current match flash for a brief period of time.More →
This proved to be pretty simple to accomplish. The concept is simple:
The details can be found in this blog post: Combining multiple assemblies into a single EXE for a WPF application.More →