Skip to content

Instantly share code, notes, and snippets.

View nall's full-sized avatar

Jon Nall nall

View GitHub Profile
@nall
nall / makefile
Created June 4, 2009 22:34
USBTiny Example OSX Driver
all:
gcc -g -std=c99 -o usbtiny_osx usbtiny_osx.m -framework Foundation -framework IOKit
clean:
rm -rf usbtiny_osx
@nall
nall / stack.c
Created June 5, 2009 23:35
x86 stack change code
// Program to demonstrate how to change to a new stack section on x86
#include <stdlib.h>
#include <stdio.h>
#define ALTSTACK
void* altStack = 0;
void core()
{
-- Applescript to save the current clipboard, send STUNTAZ!!! to the current text area
-- and restore the clipboard
--
-- Jon Nall
-- 08Sep2009
set theCommand to "STUNTAZ!!!"
set theOldClipboard to the clipboard
set the clipboard to theCommand
--delay 0.2
@nall
nall / Automount Encrypted Image.scpt
Created September 30, 2009 03:31
Applescript to automount encrypted image
(*
Automount Encrypted Image
This script monitors for a volume to be attached and upon detection, mounts an encrypted image on that volume
This folder action is intended to be used on /Volumes. When it's detected that /Volumes/<theVolume> is attached, it will automatically try to attach /Volumes/<theVolume>/<theEncryptedVolume>
Copyright © 2008-2009, Jon Nall, STUNTAZ!!!.
*)
@nall
nall / KBCollectionExtensions.h
Created October 18, 2009 05:31
Kicking Bear Collection Extensions
//
// KBCollectionExtensions.h
//
// Created by Guy English on 25/02/08.
// Copyright 2008 Kickingbear. All rights reserved.
//
#import <Cocoa/Cocoa.h>
/*
@nall
nall / DumpGarmin.pl
Created December 8, 2009 00:59
Dump Garmin XML
#!/usr/bin/env perl
my $date = `date "+%m%d%y"`;
chomp($date);
my $tmpfile = "/tmp/GRMN_".$date.".xml.tmp";
my $file = "$ENV{HOME}/Documents/GRMN_logs/GRMN_".$date.".xml";
print "Reading from GPS...\n";
system("/Library/MotionBased/GpstoMb Xml=true GzipBase64=false > $tmpfile 2> /dev/null");
@nall
nall / Crontab Template
Created January 21, 2010 00:50
crontab format
# Crontab format
# Use an asterisk to mean "all legal values"
# Use comments to separate values of a field
# Use a hyphen to denote a range
# Use a / to denote division (3-59/5 * * * * * means every minute between 3-59 which is divisible by 5)
# +---------------------- The Minute (0-59)
# | +------------------- The Hour (0-23)
# | | +---------------- The day of the month (1-31)
#ifdef DEBUG
BOOL GET_BIT(uint32_t value, uint32_t bit)
{
assert(bit < (sizeof(value) * 8));
return ((value >> bit) & 1);
}
uint32_t SET_BIT(uint32_t value, uint32_t bit, BOOL bitValue)
{
assert(bit < (sizeof(value) * 8));
@nall
nall / Git Tips.sh
Created February 11, 2010 09:38
My Git Cheat Sheet
# Force a git push for a non-fast fwd update
git push origin +master:master
@nall
nall / osx_getmem.c
Created February 24, 2010 06:00
Code to get mem usage for OSX process
#include <mach/task.h>
int getmem (vm_size_t *rss, vm_size_t *vs)
{
struct task_basic_info t_info;
mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT;
if (KERN_SUCCESS != task_info(mach_task_self(),
TASK_BASIC_INFO, (task_info_t)&t_info, &t_info_count))
{
return -1;