Huntly Cameron ­//My blog type thing…

This is (probably) not the blog you’re looking for…

This is more just a collection of things I’ve found useful enough to save for future use.

List Files Modified Across Two Commits

A quick handy wee snippet, if you wish to get a list of all files changed across two commits use the following syntax: git diff --name-status $SHA1 $SHA2

Vim delete range

Often I have a large SQL backup file I only need to extract a table and its information out of. To do this I’ve found that all you need to do is find the line you wish to delete up to and enter the following command. 1,.d This tells vim for the range 1 (line 1) to . (the current line), delete. You can, of course, do something like: 1,6170d But where’s the fun in that???

Personal Font Collection on Linux

Tried on Ubuntu 15.04, you can create a .fonts folder in your home folder and chuck all your fonts in there. Just be sure to refresh the font cache. mkdir ~/.fonts cp yourfonts ~/.fonts sudo fc-cache -f -v

html5 number field

By default, the HTML5 <input type="number"> field is a floating point value. I.e. 2.0 rather than 2. If you want a whole number (1, 2, 34, 230, e.t.c) you need to implement the step attribute along with the min attribute, like so: <input type="number" min="0" step="1">

Non greedy Regex

Turn a “greedy” regex into a non greedy one by using a question mark.

Git log with file list

Use git log --stat to show the log with the files that have changed (much like svn log -v)

Shell Calendar

To see the current month, just type cal. To show a specific month type cal -m2 where 2 is the month number - in this case Fabuary. For a specific month of a specific year, type cal -d2014-02 where the -d param is yyyy-mm. To get the calendar for the full year, type cal 2015

Placerctrl Ubuntu 15.04

I’ve been using i3 as my default window manager recently and wanted a way to controll my music from my keyboard using the media buttons. Volume wasn’t a problem, but I wanted to use my pause, next, and prev keys as well. I found playerctl, which is a way to control your music from the command line

Hello World

Testing out jekyll blogging for no reason