Skip to content

Instantly share code, notes, and snippets.

@atr000
atr000 / i_ching.dat
Created March 14, 2011 15:38
iching.c
2
Ch'en
Earth, mother, people, etc.,
submission.
23
Po
Collapse, splitting apart,
dispersion.
8
Pi
@atr000
atr000 / set_c.py
Created March 14, 2011 06:55
Sets the FSTypeCode of the given file(s) to the specified code
#!/usr/bin/env python
"""A very simple script to set FSTYPE info field on a file.
Usage: ./set_c.py [-h] [-t '????'] [-T 1061109567] FILE [...]
Sets the FSTypeCode of the given file(s) to the specified code -
'OggS' by default.
(This script requires Mac-platform python modules.)
"""
@atr000
atr000 / osxSystemDict.py
Created February 10, 2011 17:53
osxSystemDict.py
import sys
import DictionaryServices
def main():
try:
word = " ".join(sys.argv[1:])
except IndexError:
errmsg = 'No term entered to look up in the dictionary'
sys.exit()
wordrange = (0, len(word))
@atr000
atr000 / gatherFinderWindows.scpt
Created February 10, 2011 04:41
gatherFinderWindows.scpt
tell application "Finder"
-- get desktop dimensions (dw = desktop width; dh = desktop height)
set db to bounds of window of desktop
set {dw, dh} to {item 3 of db, item 4 of db}
end tell
tell application "System Events"
repeat with proc in application processes
tell proc
repeat with win in windows
@atr000
atr000 / findProxy.c
Created February 5, 2011 16:23
findProxy.c
/*
* FindProxies.c
*
* --------------------------------------------------------------------------------------
*
* The contents of this file are subject to the NOKOS License Version 1.0a (the
* "License"); you may not use this file except in compliance with the License.
*
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
@atr000
atr000 / sysprefs.m
Created December 21, 2010 04:59
system prefs
// (c) 2002 Julien Jalon <jalon@julien-jalon.org>
// See license info at the end of this file.
#import <Foundation/Foundation.h>
#include <CoreFoundation/CoreFoundation.h>
#include <SystemConfiguration/SystemConfiguration.h>
#define PRINT(X) printf("%s\n", [[NSString stringWithFormat:@"%@", (X)] ISOLatin1EncodedCString])
@atr000
atr000 / wol.c
Created December 18, 2010 08:23
wol
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
int main( int argc, char **argv )
{
int i,x,sockfd,an=1;
long n;
char buffer[201];
char mac[102];
@atr000
atr000 / machSandman.c
Created December 18, 2010 08:13
sleep
#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[])
{
@atr000
atr000 / whoami.c
Created December 18, 2010 05:09
nice util to aid shell/home scripts on finding the remote ip over a ssh connection
/*
* $Id: //websites/unixwiz/unixwiz.net/webroot/tools/whoamip.c#1 $
*
* written by : Stephen J. Friedl
* Software Consultant
* Tustin, California USA
* http://www.unixwiz.net/tools/
*
* ***********************************************************
@atr000
atr000 / getCaminoURL.scpt
Created December 17, 2010 14:49
GetCaminoURL.applescript
-- GetCaminoURL.applescript
-- Created by Thomas Willson on 8/7/09.
-- Copyright 2009 __MyCompanyName__. All rights reserved.
try
tell application "System Events"
set isRunning to ((application processes whose (name is equal to "Camino")) count)
end tell
if isRunning is greater than 0 then