QOTD

The unsolvable problem Goodell has is that he runs a hyper-profitable entertainment entity that depends vitally on the destruction of the human body for a substantial part of its entertainment function

--Charles P Pierce


Automatically killing processes that use too much memory

Every other week or so, I run some sort of code on my workstation that uses more memory than I expect. If I'm lucky, I notice the swap space graph climbing in my taskbar's monitor, and quickly find and kill the process. If I'm not so lucky, it keeps consuming memory until my workstation is effectively frozen.

These processes are never system-critical, so I put together a little script that will find these jobs and kill them before they become a problem.

1) Drop this in a file of your choosing, replacing my username and paths with your own_

ps -o %mem,pid,comm,args -U cmiller | perl -ane 'if($F[0] > 80.0){print $F[1] . "\n";}' | while read i;do echo "$(date): Killing $_" >>/home/cmiller/logs/killbigmem.log;kill $i;done

It's using ps to grab processes, then looking for those that are using more than 80% of the system memory. This may or may not be the threshold that you want to use. Also note that it also logs the process it just killed, so you can figure out where your job went later.

2) Make the file executable_

chmod +x killbigmem.sh

3) Put the process in your cron so it runs every minute. Run crontab -e, then insert the following line (again, replacing paths as necessary).

*/1 * * * * /gscuser/cmiller/usr/bin/killbigmem.sh

QOTD

And when he died, I suddenly realized I wasn’t crying for him at all, but for the things he did. I cried because he would never do them again, he would never carve another piece of wood or help us raise doves and pigeons in the backyard or play the violin the way he did, or tell us jokes the way he did. He was part of us and when he died, all the actions stopped dead and there was no one to do them the way he did. He was individual. He was an important man. I’ve never gotten over his death. Often I think what wonderful carvings never came to birth because he died. How many jokes are missing from the world, and how many homing pigeons untouched by his hands? He shaped the world. He did things to the world. The world was bankrupted of ten million fine actions the night he passed on.

-- Ray Bradbury, Fahrenheit 451


Remapping Your Macbook's Keyboard in Ubuntu 12.04

I just installed Ubuntu 12.04 (Pangolin) on the Macbook Pro that I got from work. The fact that Apple rearranges the has a different bottom row of keys drives me nuts, though. The placement of the Command keys are where the Alt keys should be, and there is no right ctrl key. My muscle memory is trained for a standard keyboard and fighting it, especially while coding, slows me down a lot.

Luckily, there's a utility called xmodmap that will let you remap these keys however you want. Here's what we're going to do_

Drop the following code into a text editor and save it somewhere. I saved it as .xmodmappings in my home directory_

! 
! clean most of the modifiers
clear control
clear mod4
clear mod1

! -----------------
! left side
! ----------------
! keycode 64 is the left alt key
keycode 64 = Super_L
! key code 133 is the left command key
keycode 133 = Alt_L Meta_L

! ------------------
! right side
! -------------------
! key code 134 is the right command key
keycode 134 = Alt_R Meta_R
! keycode 108 is the right alt key
keycode 108 = Control_R

add mod4 = Super_L
add mod1 = Alt_L Meta_L
add mod1 = Alt_R Meta_R
add control = Control_L
add control = Control_R



To test this, drop into a terminal and type

$ xmodmap ~/.xmodmappings</code>

It should make the following changes_ Left Alt -> Left Super Left Command -> Left Alt Right Command -> Right Alt Right Alt -> Right Ctrl

Now test it out. If everything looks kosher, you can set this to run every time by pulling down the gear/power menu from the taskbar, choosing "Startup Applications", and adding a new item containing the above command.

Note that this works on a 7th-gen Macbook, and the layouts may differ slightly on other models. If it doesn't work for you, running xev from a terminal will let you discover the keycodes for your model, which you can substitute into the above script.


QOTD

Anti-intellectualism has been a constant thread winding its way through our political and cultural life, nurtured by the false notion that democracy means that 'my ignorance is just as good as your knowledge.'

--Isaac Asimov


Big Heads

Aside from the big heads, The Show's finest hour came during the 2009-10 season, when the entire fan section dressed up as Mormon missionaries, complete with name tags and bike helmets, as San Diego State faced Jimmer Fredette and BYU.

via Grantland


QOTD

I would love to believe that when I die I will live again, that some thinking, feeling, remembering part of me will continue. But as much as I want to believe that, and despite the ancient and worldwide cultural traditions that assert and afterlife, I know of nothing to suggest that it is more than wishful thinking. . . . Far better, it seems to me, in our vulnerability, is to look death in the eye and to be grateful every day for the brief but magnificent opportunity that life provides. -Carl Sagan

Holy shit, we live in the future

I have a small device in my pocket that allows to me to access a compendium of all human knowledge virtually instantly. I can control that device by talking to it.

This little gadget knows where I am, and can offer me directions to anywhere that I want to go. Soon, it will beam those directions straight to my self-driving car.

Later this year, I'll be able to replace that device with a pair of glasses, which will do all of the above, but will also be able to augment my vision by superimposing information onto my surroundings.

Our wars are increasingly being fought by robots.

Our financial markets are mostly composed of algorithms with super-human speed fighting against one another for leverage. Humans are already unable to understand many of the decisions that are made or react in time to stop them. The same forces are at work in our retail stores, where quasi-intelligent algorithms create content, list it, and jostle with each other to affect the pricing.

A device built into a USB key that can sequence your genome is about to be released.

We have three dimensional printers that can rapidly produce tangible objects and can even be used to create replacement body parts.

This is not science-fiction, this is the present - and holy crap is it cool.


Vaccines and Breastmilk

ResearchBlogging.org

One of my facebook friends posted a link to an article provocatively titled_ CDC researchers say mothers should stop breastfeeding to boost 'efficacy' of vaccines.

About the only good thing I can say about that site is that they linked to the original paper so that I could read it. As it turns out, the article completely misrepresents the study and it's conclusions.

As background, you should know that vaccinations work by taking dead or attenuated (weakling) viruses and getting them into the body, which trains the child's immune system to recognize them. Breast milk also contains antibodies against many viruses, which can help defuse threats before they manage to cause serious infections in the kid.

This study focused on rotavirus vaccines that are given orally. What they found was that when breast milk and the vaccine are given at nearly the same time, the antibodies in the milk hit the dead viruses and neutralize them before the child's immune system has a chance to see them. As a result, the kid's immune system doesn't learn to recognize the threat, and the vaccine doesn't work.

Their recommendation is that the mother delay breast-feeding for a little while beforehand and a little while afterwards, to give the vaccine time to get into the kid before the breastmilk neutralizes it all_ "A short delay of breast-feeding at the time of immunization might be the least complicated intervention to improve the efficacy of these vaccines"

So no, they're emphatically not recommending that people stop breastfeeding altogether. They're just saying that by telling mothers to stagger their feeding a little bit, we can make the vaccine more effective and save thousands of lives! How cool is that?!

Another important point is that the study re-emphasizes how breastmilk helps defend kids against real viruses. One commenter, who has clearly been drinking the kool-aid, interpreted that to mean that breastmilk should be enough, and that maybe we should be getting rid of vaccines all together. That's a dangerous idea, because while breast milk is great, it just isn't enough.

Right now, about a half-million kids die every year from rotavirus, and 2 million more get severely ill. This happens even though lots of these kids are being breastfed. It's also important to note that once a child's immune system recognizes the threat, it'll remember that even after the kid is done breastfeeding. This means the vaccine helps keep toddlers safe too.

Nothing drives me crazier that people distorting science to try to push an agenda based on fear and wishful thinking. Vaccines save lives, and we need to keep spreading that message loud enough that it drowns out the dangerous and false information being spread by anti-vaccination proponents.
Citation

Moon SS, Wang Y, Shane AL, Nguyen T, Ray P, Dennehy P, Baek LJ, Parashar U, Glass RI, & Jiang B (2010). Inhibitory effect of breast milk on infectivity of live oral rotavirus vaccines. The Pediatric infectious disease journal, 29 (10), 919-23 PMID 20442687


QOTD

It is not possible to be a scientist unless you believe that knowledge of the world, and the power which this gives, is a thing which is of intrinsic value to humanity, and that you are using it to help in the spread of knowledge, and are willing to take the consequences.

--Robert Oppenheimer


For Veteran's Day

At the Un-National Monument Along the Canadian Border
William Stafford

This is the field where the battle did not happen,
where the unknown soldier did not die.
This is the field where grass joined hands,
where no monument stands,
and the only heroic thing is the sky.

Birds fly here without any sound,
unfolding their wings across the open.
No people killed — or were killed — on this ground
hallowed by neglect and an air so tame
that people celebrate it by forgetting its name.


We have a name for the kind of person who collects a detailed, permanent dossier on everyone they interact with, with the intent of using it to manipulate others for personal advantage - we call that person a sociopath. And both Google and Facebook have gone deep into stalker territory with their attempts to track our every action. Even if you have faith in their good intentions, you feel misgivings about stepping into the elaborate shrine they've built to document your entire online life.

Despite the snarky pullquote, this really is a brilliant little summary of the state of the web, FOAF, and social networking_ The Social Graph is Neither


Dark Days

Sunday, the US engaged in its yearly ritual of setting back the clocks, and so today, I walked out of work at 5_30 into the dark of night, with the moon already high in the sky. As I trudged to my car, I couldn't help thinking that it was silly. "Surely", I thought, "there must be more people who would enjoy an hour of daylight in the evening than in the morning".

With some help from Ask Metafilter, I tracked down this NYT infographic, which is based on information from the 2008 American Time Use Survey. It turns out that at 630 am, which is roughly when the sun rose today, 53% of employed people are sleeping. What a waste of sunlight. At 500 pm, which is roughly when the sun set today, only 3% of people are sleeping.

With this in mind, I propose that we eliminate standard time and move permanently to Daylight Savings time. There are arguments to be made based on energy savings or mitigating the effects of Seasonal Affective Disorder here, but dammit, it should be enough that it would make a whole lot of people's evenings suck less.


QOTD

There are some oddities in the perspective with which we see the world. The fact that we live at the bottom of a deep gravity well, on the surface of a gas covered planet going around a nuclear fireball 90 million miles away and think this to be normal is obviously some indication of how skewed our perspective tends to be --Douglas Adams