Skip to content

Category Archives: Programming

Programming techniques and languages

Python script for engineering format

21-Oct-11

# -*- coding: cp1252 -*- from math import tan, pi, sqrt, log, floor def eng(x, sigfigs=3):     m = floor(log(x)/log(10)/3)*3     LUT = {        -18: "a",        -15: "f",        -12: "p",        -9: "n",        -6: "ยต",        -3: [...]

Fail on IronRuby 1.1: hacking the configuration (app.config or exe.config) file location

05-Jan-11

Summary: I can’t get IronRuby to over-ride where it gets its app.config file. Because I’m glutton for punishment, I decided to try out IronRuby to do some dev work in .NET. I went with the latest IronRuby, which is in .NET 4.0–mostly because it integrates with Visual Studio 2010. One of my first stumbling blocks [...]

Using git with large files

20-Jul-10

I’m using git to keep snapshots of large files. These are outputs of long runs of tools, that would take a long time to re-construct. Using git has the benefit of true version control on the input design files, and an archive of the large, time-consuming outputs. The idea here, however, is to save time, [...]

Stop git from showing unrelated files

21-Apr-10

If you have a lot of files you’re not going to check in, git’s default behavior of showing untracked files can get cluttersome (new word I just made up). Doing the following suppresses this behavior: git config status.showUntrackedFiles no In the git-config man page, it shows it as case-sensitive, but I tried it all lowercase [...]

Python pretty print in hex

12-Mar-10

I recently needed to pretty print something from Python, but I needed the integers printed in hex rather than decimal. I overloaded the PrettyPrinter class to do it.