Skip to content

Instantly share code, notes, and snippets.

View eahrold's full-sized avatar

Eldon Ahrold eahrold

View GitHub Profile
@eahrold
eahrold / Jave SE6 for OS X
Last active August 29, 2015 13:58
Adobe CS6 Needs Java SE6 Runtime... Here's the OS X Link
http://swcdn.apple.com/content/downloads/21/49/091-7363/o9veiecea89qkdmk94met1af4wu2fuwn2j/JavaForOSX.pkg
@eahrold
eahrold / format_string.m
Created April 23, 2014 17:40
formatted strings in objective-c classes
-(void)writeFormatString:(NSString*)format, ...
{
if(format){
va_list args;
va_start(args, format);
NSString *str = [[NSString alloc] initWithFormat:format arguments:args];
va_end(args);
}
}
@eahrold
eahrold / github_latest_release.py
Created July 12, 2014 04:06
get the URL for the uploaded dmg, zip, or gzip from the latest release using api.github.com
import json
import urllib2
def github_latest_release(user,repo):
SUPPORTED_TYPES=['dmg','zip','gz']
DEST=str(u'https://api.github.com/repos/%s/%s/releases' % (user,repo))
data = json.load(urllib2.urlopen(DEST))
try:
latest_release = data[0]['assets'][0]['browser_download_url']
for t in SUPPORTED_TYPES:
@eahrold
eahrold / version.string.regex
Last active August 29, 2015 14:11
Version String Detection Regex
(\d+)\.(\d+)(\.(\d+))?(\.(\d+))?(?:(?:-(alpha\d*|beta\d*|rc\d*))?)
Will detect these formats
1.21.23
1.21.23-rc
1.21.23-rc1
2.21.23-alpha
1.211.233-beta12
3.12
@eahrold
eahrold / jds_post_test.py
Last active August 29, 2015 14:11
Test POST to your JDS
#/usr/bin/python
''' if you don't have the requests module installed you'll need to do that
with either pip or easy_install'''
import os,requests
''' Setup server and auth data. This is the name of your JSS,
NOT the webdav share of the JDS. The JSS actually distributes the
data you upload to it across the JDS shares.
'''
@eahrold
eahrold / simple-mount.m
Created February 12, 2015 15:16
Most basic cocoa based network mount. Set to NOT prompt for user interaction.
#import <NetFS/NetFS.h>
///....////
- (void)mount:(NSURL *)networkShare user:(NSString *)user password:(NSString *)password
{
NSURL *mountPath = [NSURL URLWithString:@"/Volumes/"];
dispatch_queue_t myQueue = dispatch_get_main_queue();
AsyncRequestID requestID = NULL;
@eahrold
eahrold / afp_mount_test.py
Last active August 29, 2015 14:16
Mount an AFP Share (JSSImporter test...)
#!/usr/bin/env python
import urllib
import subprocess, os
''' Set these '''
user = "your_username"
password = "your_password"
server = "your.server.com"
@eahrold
eahrold / NSTextField+controlTextDidPause.h
Last active August 29, 2015 14:21
Monitor NSTextFiled for a pause during user input.
//
// NSTextField+controlTextDidPause.h
//
// Created by Eldon Ahrold on 5/23/15.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@eahrold
eahrold / mwa_to_xls
Last active January 2, 2016 12:59
Export MunkiWebAdmin Data to CVS
sqlite3 -csv munkiwebadmin.db "SELECT * FROM reports_machine;"
@eahrold
eahrold / rm_global_login.py
Last active January 3, 2016 04:49
Global Login Item are deprecated remove them with this
#!/usr/bin/python
'''
Pass in the Full path to the application as the first arg
for example /usr/local/sbin/rm_global_login.py /Applicaitons/MunkiMenu.app
'''
import os
import sys
from LaunchServices import *