Skip to content

Instantly share code, notes, and snippets.

#include <IOKit/IOKitLib.h>
#include <IOKit/pwr_mgt/IOPMLib.h>
#include <IOKit/IOReturn.h>
#include <mach/mach_init.h> /* for bootstrap_port */
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
int main(int argc, char *argv[])
{
/*
* Copyright (c), MM Weiss
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
/* mac-fix-env: A small utility to pick up the shell environment on MacOS X
and insert it into the file ~/.MacOSX/environment.plist
creating if necessary.
Copyright (C) 1989, 1993, 2005, 2008, 2009 Free Software Foundation, Inc.
This file is part of GNU Emacs.
GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
@atr000
atr000 / ScreenFrame.m
Created May 26, 2010 11:06
ScreenFrame.m
/*
This is a free command line utility made by ief2.
You are allowed to use it for personal use, publishing
or usage in self-made applications.
Developer's Site:
http://developerief2.site11.com
*/
#import <Foundation/Foundation.h>
@atr000
atr000 / pdfPageCounter.m
Created May 23, 2010 11:52
pdf page counter using quartz in objc
/* from scriptbuilders. cheap way to utilize quartz on osx for pdf pagecount */
#import <Foundation/Foundation.h>
#import <Quartz/Quartz.h>
int main (int argc, const char * argv[]) {
if (argc != 2){
printf("Usage: PDFPageCounter path\n");
return 1;
#!/usr/bin/env python
# found this somewhere pasted but can't recall.
# bare-minimum requirement to do geo stuff with python when you can't benefit from
# the numerous and powerful libs that normally do this.
import math
def haversine_distance(p1, p2):
# points are lat, lon
# and degrees
//
// Programmer: Craig Stuart Sapp <[email protected]>
// Creation Date: Tue Jan 20 11:13:16 GMT-0800 1998
// Last Modified: Sun Jan 9 10:34:22 PST 2000 (minor changes)
// Last Modified: Thu Aug 2 13:52:52 PDT 2001 (added stdlib.h for new gcc)
// Last Modified Tue Apr 9 12:24:27 PST 2002 (added Mac options)
// Last Modified Mon Jan 20 21:12:52 PST 2003 (enabled conversion from mac to other)
// Last Modified Wed May 18 14:03:03 PDT 2005 (updated for newer C++ compilers)
// Last Modified Sun Aug 21 21:41:47 PDT 2005 (fixed so running -d twice works)
// Web Address: http://www-ccrma.stanford.edu/~craig/utility/flip/flip.cpp
# apple/shell script to trigger the kext prior via boot.sh prior to launch
do shell script "sudo '/Library/Application Support/VMware Fusion/boot.sh' --start" password "YOUR_PASSWORD_HERE" with administrator privileges
/* keyremap.c
*
* features:
* 1. map lower enter to forward delete key - useful for macbooks
* (works only when secure event input is not activated,
* which happens very rarely, e.g. when password fields are focused)
* 2. send enter key event when right command key is released
* without any other key pressed while it was down
*
* by Bert Mu"nnich, January 2009
#!/usr/bin/python
# author: Martin Michel
# created: 29.03.2010
# The script prints all dates of the given year together with the
# corresponding week and weekday number
# Useful when you need to know the dates of a week number