Tiddlywiki to Org-Mode


Okay, I swear this is the last document conversion script I’m writing this year. I’ve been on a bit of a rampage to move all of my life in Emacs Org-Mode and converting all of my Tiddlywiki notes into Org mode has been on my list for a while. Thankfully both formats are pretty simple so the script was fairly straightforward.

You can find it here, simply fill in the folder locations and give it a run.

A heads up. If you’re merging the newly generated Org notes into an existing directory, do a dry run in a dummy folder first then compare the dummy results with your existing Org folder. You need to ensure you won’t overwrite any existing files(the script doesn’t do any clever checking).

You can do something like

to run an intersection on the two filesets.

Flattr this!

Verify you’re hidden with conky


I run a few scripts to ensure my identity stays hidden day to day on my laptop. Here’s a few conky scripts to verify things are as they should be.


Because I don’t always know my ip or what my VPN’s ip is, I wanted conky to display the location I currently appear at from my VPN. If the location was the same as where I physically am, something’s gone wrong. To implement this, I wrote a python script and using ipinfo.io grab my location and print it to conky.

Here’s the script I use to pull my location.

And here’s the conky configuration I use to call it.

Note: VPN’s don’t always completely hide your location. See http://dnsleaktest.com for an example of how it can be circumvented.

Mac Address

For my mac address I wanted to be able to see my wifi adaptors physical address and what it should be spoofed to. If the two are the same, something’s else has gone wrong.


I also like to randomise my hostname on startup using this script.

Flattr this!

SugarCRM 7 – Adding an action to the listview headerpanel

A red button with the words "Take action" on it

This tutorial should show you how to add a custom button/action that will appear across all modules. It’s a little similar to this tutorial with a few changes to how the button gets rendered and the actions get called.

1. Adding the button to the headerpanel

Firstly you’ll need to create a new folder to store the headerpane actions, so create this folder in the sugarcrm root directory custom/clients/base/views/list-headerpane/. Then create the file list-headerpane.php with this content. This will add a button next to the Create button for all modules.

2. Adding the action hook

To fire this action you’ll need to add some code custom/clients/base/views/recordlist/recordlist.js, in the initialize function add a line like this:

Now populate applyFxn with whatever code you want to run and it will work across every module.

3. Quick Repair and Rebuilt(as always)

Any questions feel free to ask!

Extra tip.

Only want to do this for a single module. Instead of placing the code in custom/clients place it in custom/modules/<MODULE_NAME>/clients and it should work for just that one module.

Flattr this!

SugarCRM – Prevent currencies getting overridden


SugarCRM has some neat features involving currency rates, but one of the more annoying ones is that Sugar will automatically update the base rate every time you save a record with a currency field attached. This can be fairly annoying default behaviour if you wish to maintain the correct record value at the time of sale.

The problem
Say for example you have a custom module Books and your systems base currency is USD. You sell a book for 10 Euros at 11 dollars(the currenct change rate). If say a few weeks later you wanted to change the status of the Book to say, note down that the invoice was received and the exchange rate in that time has changed drastically. When you hit save Sugar would re-calculate the Euro value again(and despite the item being sold for 10 Euros originally the exchange rate has now changed and Sugar shows say 12 Euros, which is completely inconsistent with what you’ve invoiced.

The solution
There is thankfully a way around this using by overriding Sugar’s default behaviour using logic hooks. So taking our book example this is what custom/modules/Books/logic_hooks.php might look like.


And the actual code to do the overriding would be in custom/modules/Books/logic_hooks_class.php

Using the db over-ride hack should allow you to retain the same base rate on each record and Sugar will display the original 10 Euros despite the exchange rate changing.

Some words of caution
If you decide to override Sugar’s default behaviour, you could run into some issues down the line with reporting.
Basically the reports modules seems to ignore the base rate stored on each individual record and just uses whatever the system default is.

So you’ll have totals in your report that will be inconsistent with the currency value that’s stored on the record. One way around this is to only create reports using your base currency, another is to create a secondary field storing the correct amount of the currency in a decimal field rather than a currency field and creating reports based on that amount.

Flattr this!