Eee PC: Don’t suspend when closing lid with power plugged in

Edit /etc/acpi/lidbtn.sh (as root) to contain:

#!/bin/sh
LID_STATE=`cat /proc/acpi/button/lid/LID/state | awk '{print $2 }'`
AC_STATE=`cat /proc/acpi/ac_adapter/AC0/state | awk '{print $2 }'`

if [ $LID_STATE = "closed" ] && [ $AC_STATE = "off-line" ] ; then
        /etc/acpi/suspend2ram.sh
fi
exit 0

Comments

CookiePie

CookiePie is a Firefox extension that lets you give a browser tab its own set of cookies. This is cool if, like me, you want to log into two different webmail accounts at once. (People do share computers sometimes, after all). Until recently Gmail was the one site that CookiePie didn’t work with, which spoiled my fun, but they’ve since spruced it up and now it does.

Unfortunately their webserver isn’t configured to spout the correct Content-Type header to make the XPI install work, so I packaged up the link with the correct header so that you can install it easily via this huge link you’re reading. (My link sucks the extension right from their site so you’ll still get the latest greatest.)

Comments

Talking to your Arduino, from Python, on Cygwin

It took me an hour or so of googling & trying stuff to figure this out (especially “/dev/ttyS2″), so I’ll put this here in hopes of helping future generations.

Install pyserial. Not the windows installer — download the source and then do this in cygwin:
$ python setup.py build
$ python setup.py install

Now you can connect to your Arduino from Python, inside Cygwin thus:
$ python
>>> import serial
>>> s = serial.Serial('/dev/ttyS2', baudrate=9600) # assuming COM3
>>> # use /dev/ttySn where n = COM port - 1
>>> s.writeln('hello\n')
>>> print s.read(s.inWaiting())

Here’s some Processing code to test with:

void setup() {
  Serial.begin(9600);
}
 
void loop() {
  if (Serial.available())
    Serial.print(Serial.read(), BYTE);
}

Comments

Jott Blog Post

Eri I am blogging from my cell phone.
Click here to listen

Powered by Jott.com – Try it at 1 (866) JOTT123 – Jott.com

Comments

Baby Key

My son is like most baby boys (of all ages). His favorite things in the world are (in order):
1. Boobs
2. My cell phone
3. My computer keyboard
4. The cat food dish
5. Trying to fall down the stairs
To deal with #3, anyway, I wrote a program to capture all keyboard activity (which you are invited to download) so I can still read what’s on the screen while he pounds away, without him deleting anything, replying to all with some nonsense, etc. (Caveat: It doesn’t grab the (useless) Windows key.) It also pops up an entertaining display with each keypress, but is otherwise invisible.

Through this program, I’ve confirmed that the only reason he wanted the keyboard was because I wouldn’t let him have it. Now that he’s used it a couple times, he’s not nearly as keyboard-obsessed, which makes the program like a nuclear weapon – having the program makes it unnecessary to run the program (after you fire a couple nukes first).

Comments (1)

The M. Falcon is Slow

I’d assumed for a long time that the (real-life-chronologically) first 2 2/3 Star Wars movies didn’t suck, and that made it a tragedy that the other 3 1/3 movies did suck. A while ago I realized that they all suck (example: they are called “Star Wars”. That’s right: “Star Wars”, my friend), even if they did fire the geek’s imagination, and now I feel better about it.

But anyway, I’m a geek, so sometimes I think about Star Wars and quantum mechanics, whether one sucks or both or neither.

I was contemplating on Planck units and the line where Han Solo (who shot first, btw) declares that his ship did the Kessel run in 12 parsecs, and I realized that since space and time coexist in 4 space, using the speed of light to convert units between them, then what the first-shooting smuggler was saying was that it took him more than 39 years to make the run.

And I know that others have apologized Lucas’ lack of unitary understanding away long ago, I (for the purposes of this post) don’t buy it.

I also know that ships go faster than light in hyperspace but the Kessel run is no doubt much longer than 39 light years.

Comments

Solids

i has a karot

Comments

Spying on people with cameras

If you’re going to spy on your baby, this is great for audio, but this is crap for video.

I converted a webcam to see infrared light, and wrote how.

Comments (1)

D is for Dillweed

I’ve been playing around with the D language a lot lately; it has a lot of really cool features. It also has a few rough spots, but one I just encountered that’s bafflingly horrible. This will illustrate:

uint u = 0;
int s = -1;
assert (u > s);  // assert will fail.  somebody shoot somebody.
assert ("string".length > -1);  // this one too, for the same reason.

Implicit type conversions cause more bugs than they’re worth, in general, but this is ridiculous.

Comments

The Pizza Guy

I swear to god, it only just now occurred to me: When the pizza guy brings your pizza, and he begins that long, arduous search for that last couple dollars change, he’s trying to get me to let him just keep it. (Which I generally do.) I guess that should have been obvious.

Comments

Next entries » · « Previous entries