Sep 12
2014
Previously we found that PyPy achieves the best performance gain, executing fieldfunc_py in ~6 us. At the end of that article, I mentioned that the C implementation is up to 50x faster, managing the same calculation in ~0.12 us.
The naive conclusion is that the best thing is to …
Sep 12
2014
Recently I found myself looking at the following piece of code and trying to optimise it:
from __future__ import division
import numpy as np
MagneticPermeability = 4*np.pi*1e-7
MagneticPermeabilityOver4Pi = MagneticPermeability / (4*np.pi)
def fieldfunc_py(p, q, moment):
r = p - q
rmag = np.sqrt(r.dot(r))
rdash3 = rmag …
Aug 26
2014
This is sort of a placeholder post. Busy meeting a deadline, but this should help future Steve and anyone else when you need to turn your Lyx document into a Word document while keeping the format mostly sane. Broken, but sane.
- Export as
Latex (plain).
-
Run
Nov 06
2013
Simply set the language for non-unicode programs to Chinese (PRC) and it will magically work.
N.B. You must have first installed files for East Asia Languages in Languages Tab for this to work.
Cheers,
Steve
Oct 16
2012
If you are getting the error
"Unknown control sequence: \doublespacing" when you try to compile your
beamer presentation in Lyx, change
Document→Settings→Text Layout→Line spacing
to Single.
Cheers,
Steve
Sep 14
2012
Calibre is a great tool, especially for converting between ebook formats. Here are some notes for getting it to run on a headless server.
- The binary installer off the website works fine — ignore warnings about completion and desktop integration failing.
- The installer will always pollute /usr/bin regardless of the …
Sep 14
2012
Pixelmator wins hands down. Compared to Pixelmator Acorn is anaemic in terms of features and costs more than twice as much.
Disclosure: I originally got Acorn as part of MacHeist, so I didn't pay full price for it. I did pay full price for Pixelmator.
Cheers,
Steve
Aug 23
2012
I used to use Jumpcut a long time ago, and was a big fan of it. At some point, I think around 10.5, it stopped working, and I let it go -- too busy at the time to poke at it.
Recently however my interest in it was piqued again …
Aug 19
2012
- Download SheepShaver
- Download "New World PPC ROM" from redundantrobot.com
- Extract the zip. This should produce newworld86.rom. Rename this file to ROM and put it in the same directory as SheepShaver.app
- At this point SheepShaver.app should run, showing you a folder with a blinking ? inside it
- Download …
Jul 22
2012
Over this weekend I have been working on faerii, a USB controlled RGB LED based around the ATtiny85.
Here is a picture of the breadboard prototype
|
 |
| faerii breadboard prototype |
The ATtiny85 is mid centre, and immediately above it is the ISP header. To the left of the ISP header, near …
Jul 21
2012
Here are some notes I made while trying to understand the opcodes in this fun article on generating small elf binaries. Hopefully they will be of use.
00000000 B801000000 mov eax, 1
00000005 BB2A000000 mov ebx, 42
0000000A CD80 int 0x80
In the above snippet:
- B8 is the move instruction …
Jul 21
2012
By default system python loads "fake" readline (fake because it actually uses libedit) from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/readline.so. Even if you install readline (which goes into /Library/Python/2.7/site-packages), it will still load it, even if you fiddle …
Apr 28
2012
Lyx 2.0 and onwards on OS X will use spellchecker provided by the OS X. Note however that the language it will use for spellchecking is determined by the document's language setting, not your system language setting.
Furthermore, in version 2.0.3, if you change your document's language …
Nov 15
2011
The hijack iPhone library implements Manchester encoding for digital communication. Manchester encoding maps 0 to high-low transition, and 1 to low-high transition.
The iPhone library generates the transitions using full or half period of a sine wave, using a full period when a bit run is detected. An example of …
May 29
2011
Use git init to create an empty git repository, then edit .git/config to add the svn remotes:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
[svn-remote "svn"]
url = file:///home/steve/code/svn-repos/foo
fetch = trunk:refs/remotes/trunk
branches = branches/*:refs/remotes/*
tags = tags/*:refs …
May 18
2011
svn st | grep '^?' | sed 's/^[? ]*/"/' | sed 's/\$/"/' | xargs svn add
Cheers,
Steve
May 08
2011
Here is my firehol.conf that allows multicast mDNS packets through:
# define mdns so we will accept it
server_mdns_ports="udp/5353"
client_mdns_ports="5353"
interface eth+ multi
policy return
server mdns accept
server multicast accept
interface eth+ home src "\${home_ips}"
server all accept
client all accept
Initially I had the server …
Apr 17
2011
- const char *foo; is not the same as char * const foo; The former declares a pointer to constant char, while the latter declares a constant pointer to char.
- - [NSError localizedDescription] returns the object for key NSLocalizedDescriptionKey in the error's userInfo dictionary. I always wondered how to set it since there …
Apr 15
2011
Finding myself in the position of needing to distribute several apps OTA and unable to use the more well known OTA services like testflightapp.com due to client concerns, I made my own, ICBM.
ICBM is a small python webapp built using my favourite webapp framework, bottle. You just put …
Mar 26
2011
The installers Ralink provides for some of their chipsets, like the RT2770 does something retarded: they attempt to unload a kext in a pre-install script, and when it fails the script fails and the entire install fails.
This means on a new machine, or one that never had the kext …