Oct 232015
 

I was trying to set up a fail2ban jail for wordpress inside a FreeBSD jail, but I just couldn’t get the rules to match.  The fail2ban instance was running on the host machine, checking a log inside the jail.  Turns out the time zone in the jail was incorrect, and fail2ban was not matching log entries because the time was different.

You may need to restart processes after this – I restarted both syslogd and Apache in the jail.

May 102015
 

I’ve decided that I want to build a repeater controller using an Arduino. I’ve been wanting to learn Arduino for a while, and this seems like a great excuse.  There are a lot of great repeater controllers out there already – I am a big fan of the SCOM 7330 – but they’re pricey, and this is ham radio.  We’re supposed to build stuff and experiment!

Continue reading »

Sep 262012
 

If you are running a transparent HTTP proxy on your network, you may have trouble with running Internet Recovery and Apple Hardware Test on Macs that support it.  You’ll see a “-4403D” or “-4403F” error.  For some reason, Apple’s servers return a 403 when they see the “via” header that many proxy servers send.  Here’s the configuration I used in Squid to turn off that header.  I also disabled the “forwarded-for” header – essentially, this makes it impossible for servers to determine that the request is coming through a proxy server:

Aug 112012
 

I’ve been trying to install Mountain Lion in as a guest in Parallels 7, and I kept getting stuck at the initial grey Apple logo.

To fix it, I just changed the number of CPUs to 2, and it booted right up.  Other documents I’ve seen have indicated that you need to increase the video memory.  I did not need to do that, but it would probably help with performance.

Aug 032012
 

 

Eclipse Juno looks terrible in Linux Mint 13 with the MATE desktop environment. Here’s an example of part of the screen:

Everything is big and bulky, the tool bar’s style doesn’t really match the theme’s style.

Here are the steps I’ve taken so far to correct this:

  • Create a file called gtkrc, I’ve created one in my ~/eclipse directory:
  • Next, in Eclipse, go to Window -> Preferences -> General -> Appearance, and under Theme, make sure GTK is selected.
  • Run eclipse like this:

This ought to improve it a bit:

More to come as I figure out how to further improve this.

References:

http://xmemory.tompium.com/2012/01/make-eclipse-look-better-on-ubuntu.html

 

 

May 252012
 

I can’t believe it’s taken me this long to learn this: Python’s default argument values are only evaluated once during runtime. I’ve never encountered this before because I don’t use default arguments very often, and when I do, it’s often to set something to a static value.

Today, I encountered a function definition where I wanted to default an argument to the current date/time:

Every time I ran the function, the value of date_time was the same: Whatever the date/time was when the method first ran. So, instead, I did something like this:

This is actually mentioned in the Python documentation.

May 252012
 

Install Visual Studio 2008 SP1 Express Edition.

Go to the command prompt.

First, I had to set the following variable:

Note the trailing backslash – that needs to be there. The value must also NOT be in quotes.

Then, from your PyCrypto directory, run:

And it should install with no problem.

May 032012
 

Because Python isn’t strongly typed, sometimes PyDev doesn’t know what type a variable is – and therefore it cannot give you accurate code completions. Here’s how to make that better.

In simpler situations, PyDev works very well. For example:

Typing ’emp.’ will get you a good autocomplete.

Now, let’s say you have something like this:

Then ’emp.’ won’t get you anything – PyDev doesn’t necessarily know what type is being returned.

If you use python’s assert method:

PyDev now knows what type the variable is, and you’ll get more effective code completions.

When running in production, you can pass the “-O” flag to the interpreter, and it will ignore the assert statements.

Nov 182011
 

I needed to return all the members of an object as an XML document in Python. I used the ElementTree library to do this.

The class in question is pretty basic: It has a constructor, member variables, getters and setters for the member variables, and now this new function.

Every Python class has a built-in __dict__ member, which is a dictionary ({}) of key/value pairs for all of the member variables, so I use that to get all of the variables to add to the ElementTree.

This function returns an xml.etree.ElementTree.Element object, which can be turned into a string if needed by using ElementTree’s tostring() method.