Skip to content

Category Archives: Programming

Programming techniques and languages

Fun with SchoolSpeak


So, our school has adopted SchoolSpeak as their online platform. This includes lunch orders, and I’ve been asked to help the administration out with some summary reports (at least until SchoolSpeak can directly support what we need). Basically, I need to figure out how much money was made each day of the month, totaled by […]

Python script for engineering format


[cce_python] # -*- 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: “m”, 0: “”, 3: “k”, 6: “M”, 9: “G” } return (“{0:.{1}g}{2}”).format(x*10.0**(-m), sigfigs, LUT[m]) [/cce_python] I’m not sure what grief the […]

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


Summary: I can’t get IronRuby to over-ride where it gets its 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 is […]

Using git with large files


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


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: In the git-config man page, it shows it as case-sensitive, but I tried it all lowercase and it works. Now, […]

Python pretty print in hex


I recently needed to pretty print something from Python, but I needed the integers printed in hex rather than decimal. I overloaded the [cci lang="python"]PrettyPrinter[/cci] class to do it.