Skip to content

Instantly share code, notes, and snippets.

@prehensilecode
prehensilecode / gmail_monospace.css
Created December 3, 2012 15:12
Userstyle - GMail monospace font
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain("mail.google.com") {
/* GMail messages and textarea should use fixed-width font */
.gs .ii, .textarea, textarea.Ak, .editable, .LW-af {
font-family: MonoSpace !important;
}
}
@prehensilecode
prehensilecode / Makefile.system.patch0
Created January 15, 2013 22:21
Patch to get GotoBLAS2-1.13 to compile for Nehalem under PGI 12.5. See also: http://www.pgroup.com/resources/gotoblas/gotoblas_pgi2012.htm
--- Makefile.system 2010-01-28 15:11:08.000000000 -0500
+++ Makefile.system.deac 2013-01-14 11:09:56.280298528 -0500
@@ -278,9 +278,9 @@
ifeq ($(C_COMPILER), PGI)
ifdef BINARY64
-CCOMMON_OPT += -tp p7-64
+CCOMMON_OPT += -tp nehalem-64
else
-CCOMMON_OPT += -tp p7
@prehensilecode
prehensilecode / gist:5471484
Created April 27, 2013 01:20
Trouting script for Colloquy
(*Actions.scpt
Intended for use as a template for context menu script actions
*)
--and here's how you save preferences
property prefs : missing value
property prefsPath : missing value
using terms from application "Colloquy"
on build contextual menu for item blah
@prehensilecode
prehensilecode / glom.c
Created May 9, 2013 15:40
C program to allocate memory as a way of testing system limits.
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/resource.h>
void print_rlims(char* name, struct rlimit* const rl)
{
if (rl->rlim_cur == RLIM_INFINITY)
@prehensilecode
prehensilecode / setup_magic.py
Last active December 24, 2015 14:09
Python script to disable built-in Synaptics trackpad, and set up Apple Magic Trackpad the way I like it
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
import sys
import os
import re
import subprocess
def turn_off_tp(tp_id):
subprocess.check_call(["xinput", "--disable", tp_id])
@prehensilecode
prehensilecode / change_categories.py
Last active February 14, 2017 16:38
Change node categories in Bright Cluster Manager
#!/usr/bin/python
### Change all node categories
from sys import exit
import os
# import Bright Cluster Manager bindings
import pythoncm
@prehensilecode
prehensilecode / cylon.ino
Last active January 4, 2016 18:39
cylon arduino
void cylon() {
int delayTime = 50;
for (int i = 0; i < 8; ++i) {
digitalWrite(ledPins[i], HIGH);
delay(delayTime);
digitalWrite(ledPins[i], LOW);
}
for (int i = 0; i < 8; ++i) {
digitalWrite(8-ledPins[i], HIGH);
#!/usr/bin/env python
import sys
import os
import re
import shlex
import subprocess as sp
def main():
lines = sp.Popen(['ps', '-elf'], stdout=sp.PIPE).communicate()[0]
@prehensilecode
prehensilecode / trivial.c
Last active August 29, 2015 14:05
Trivial MPI-CUDA hybrid
#include <stdio.h>
#include <cuda.h>
#include <cuda_runtime.h>
int main (int argc, char *argv[])
{
void *a_d;
MPI_Init (&argc, &argv);
cudaSetDevice(0);
printf("hello\n");
cudaError_t ierr = cudaMalloc( (void **) &a_d, 1000);
@prehensilecode
prehensilecode / cron_helper.sh
Last active March 6, 2024 15:06 — forked from liquidgecka/cron_helper.sh
Cron helper
#!/bin/bash
usage() {
cat << EOF
Usage: $0 [OPTION]... COMMAND
Execute the given command in a way that works safely with cron. This should
typically be used inside of a cron job definition like so:
* * * * * $(which "$0") [OPTION]... COMMAND
Arguments: