Posts

Showing posts from 2016

Clear GPS metadata from an image

Image
In March 2012 I wrote a blog titled,  GPS Information in photos . In it I describe how to extract and resolve Exif GPS data to a map reference. Recently I wrote an update to that blog that included how to clear metadata from an image. Essentially, the two methods I would use are: (1) Using ImageMagick with convert gps.jpg -strip stripped.jpg This  appears to re-compress the JPEG image which may not be what you want. (2) So, there is an alternative tool such as the exiv2 utility. I've not used this myself, but it seems to have great command line options.

Automation with Ansible

Ansible is a Python based automation tool. I started using it to revert changes made on my local machine every time there were package updates. That is I wanted to ensure my options and settings were preserved. Professionally my team uses Puppet but we were looking at alternatives. Ansible was chosen for a variety of reasons: it is easy to learn, has broad functionality and an active community. There is next to no new lingo to learn: a task is an action you want to perform a list of tasks can be organised into a playbook handlers are special tasks that are triggered by a change in a task a group of playbooks is organised into roles an inventory is a list of hosts (or group of hosts) to apply a playbook to playbooks are under the roles directory tasks are stored in the tasks directory, under a role variables are stored in the vars directory, under a role templates are stored in templates directory, under a role So, any typical Ansible project would look something like: ...

Converting MS Documents to PDF using LibreOffice

I've been a long time user of LibreOffice . I first started with StarOffice , before moving to  OpenOffice , and finally the latest incarnation,  LibreOffice . While I use office suites less, preferring Wiki 's and if a versioned document is required, LaTeX , I still on occasion receive MS documents. Rather than reading these documents in MS-Word or MS-PowerPoint formats I prefer to convert to a PDF. Here is how to do that. The following shows how to convert a presentation to a PDF. It is a headless operation that works just as well over a set of documents. loimpress --headless --convert-to pdf presentation.pptx Similarly, lowriter --headless --convert-to pdf document.doc
Render R markdown to PDF from command line I have been using Makefiles where command line tools for building a project are not generally available. This includes LaTeX documents and recently R projects. So here is an R script that can be used to render R markdown to PDF. #!/usr/bin/env R # Render R markdown to PDF. # Invoke with: # > R -q -f make.R --args my_report.Rmd # load packages require ( rmarkdown ) # require a parameter naming file to render if ( length ( args ) == 0 ) { stop ( "Error: missing file operand" , call. = TRUE ) } else { # read report to render from command line for ( rmd in commandArgs ( trailingOnly = TRUE )) { # render Rmd to PDF if ( grepl ( " \\ .Rmd$" , rmd ) && file.exists ( rmd )) { render ( rmd , pdf_document ()) } else { print ( paste ( "Ignoring: " , rmd )) } } } It will process Rmd files l...

Hint: Use gmail as a to-do list

I have tried a number of to-do lists, and have been sadly disappointed in them all. The problem for me is that they restrict what can be put into them. That is can I add, images, links and formatted notes into a to-do item? My solution is: use GMail drafts. The steps are: compose a new email without assigning an addressee give it a meaningful summary subject line prefixed with "ToDo: " add all the content you need into the subject line once the item has been complete, remove draft The benefits to this approach are numerous: they can be read from any device that has access to GMail. They can contain rich content. They are neatly collated into the Drafts GMail folder. FInally, if I need to keep a copy of anything in the email I can choose a variety of methods including: sending completed email to myself, creating a Drive document, or just cutting and pasting relevant information elsewhere. What do you think? Let me know in the comments.

Evolution

Image
In the book, Life's Grandeur , Stephen Jay Gould goes into detail why the most common misconception of Evolution by Natural Selection. That is the misconception that evolution progresses from lesser forms, to more advanced, complex forms. Indeed Charles Darwin disliked the term evolution as it carries with it exactly this connotation. Instead he preferred the term, Descent by Modification. When you look at the principles behind Darwin's great idea the reasons for his objection become apparent. There are just three simple propositions: organisms tend to produce more offspring than can possibly survive off-spring vary among themselves and not identical to their parents off-spring inherit at least some of these variations That is it. The remainder is about following the consequences of these principles. Darwin deduced that, given the above, then those organisms best able to adapt to their local environment will tend to have an advantage. That advantage help...