MAC Aluminium Keyboard Disassembly

There are a couple of Aluminium mac keyboard disassembles on the internets. One here and another here (both of the same physical keyboard!). I decided to disassemble my own, hopefully nondestructively. I took the advice of one of the commenters and heated the keyboard in an oven at 100 degrees C. That helped loosen the glue which holds the front of the keyboard to the plastic backing, the downside is that the heat slightly warped the shift key and also that I burninated my hand!

I then eased a knife under the plastic and removed it. It’s tough but mostly nondestructive. I think it could go back together again. Anyway here are the pictures:

So you can get to the FPC cables reasonably easily. If you wanted to get to the membrane nondestructively I think you’d run in to trouble. The membrane is backed with a metal sheet which appears to be riveted to the aluminum frontpiece.

Delete duplicate emails in mutt

“Let say you want to delete all duplicate messages in the current mailbox. Just do a tag-pattern (bound to T here), put in ~= as the pattern, then all duplicates will be tagged. After that, you can delete tagged messages (bound to ;d, or just d if you have $auto_tag=yes).”

Robbed from here. However it doesn’t work unless you are sorted in thread mode as described here.

You don’t exist, go away!

new@compy:~> ssh localhost -lroot
You don’t exist, go away!
new@compy:~>

A paradoxical existential critic of your solipsistic non-existence is probably not what you want to be greeted with when attempting to administrate your box. The error actually means the system can’t lookup your userid. Which means your usernumber say 500 can’t be resolved to your username say: cpugwash.

Possible causes are:

Your user has been deleted from the /etc/passwd file.
Your user has been deleted from another authentication system you use, like LDAP.
Your LDAP or other authentication server is not running.

In my case, LDAP had crashed and needed restarting.

Some random rambling on this topic here.

Simple OpenCL example

Adapted from here: http://developer.amd.com/GPU/ATISTREAMSDK/pages/TutorialOpenCL.aspx

But tidied up a little and made to work on MacOS. It creates a OpenCL executor “thing” and tells it to run a kernel which writes “Hello World” to a buffer, this gets sent back to the main C++ program.

#include “cl.hpp”
#include
#include

std::string prog(
“#pragma OPENCL EXTENSION cl_khr_byte_addressable_store : enable\n” \
“__constant char hw[] = \”Hello World\”; \n” \
“__kernel void hello(__global char * out) {\n” \
” size_t tid = get_global_id(0); \n” \
” out[tid] = hw[tid]; \n” \
“}\n”);

int main(void) {
cl_int err;

// Get list of platforms (things that can execute OpenCL on this host), get a “context” on the first executor.
std::vector platformList;
cl::Platform::get(&platformList);
cl_context_properties cprops[3] = {CL_CONTEXT_PLATFORM, (cl_context_properties)(platformList[0])(), 0};
cl::Context context( CL_DEVICE_TYPE_CPU, cprops, NULL, NULL, &err);

// Allocate 100 bytes of memory which we will use to communicate with the OpenCL context, executor, whatever.
size_t mem_size = 100;
char * outH = new char[mem_size];
cl::Buffer outCL( context, CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR, mem_size, outH, &err);

// Give the OpenCL program embedded in the string above to OpenCL.
cl::Program::Sources source(1, std::make_pair(prog.c_str(), prog.length()+1));

// Get devices used in this “context”
std::vector devices;
devices = context.getInfo();

// Compile program against device
cl::Program program(context, source);
err = program.build(devices,””);

// create a kernel object, tell it we are using the kernel called “hello”, give it an argument which is the memory we alloc’d above.
cl::Kernel kernel(program, “hello”, &err);
err = kernel.setArg(0, outCL);

// Queue the kernel up to run
cl::CommandQueue queue(context, devices[0], 0, &err);
cl::Event event;
err = queue.enqueueNDRangeKernel( kernel, cl::NullRange, cl::NDRange(mem_size), cl::NDRange(1, 1), NULL, &event);

// Use the event object above to block until processing has completed
event.wait();

// Read the results out of the shared memory area.
err = queue.enqueueReadBuffer( outCL, CL_TRUE, 0, mem_size, outH);

// Write to screen
std::cout << outH; } [/sourcecode] On MacOS compile it with: g++ ./simple.cpp -framework OpenCL -o simple You'll also need to C++ bindings for OpenCL which are available here: http://www.khronos.org/registry/cl/api/1.0/cl.hpp Tarball containing all this is HERE untar it and type make to build.