Skip to content

Instantly share code, notes, and snippets.

@mosen
mosen / Share.swift
Created March 6, 2018 04:55
Convenient swift-like wrapper over NetFS smb mounting
import Foundation
import NetFS
enum ShareMountError: Error {
case InvalidURL
case MountpointInaccessible
case InvalidMountOptions
}
#!/usr/bin/python
from CoreFoundation import CFPreferencesCopyValue, CFPreferencesSetValue, kCFPreferencesCurrentUser, \
kCFPreferencesAnyHost, CFPreferencesSynchronize
# Reading a preferences value
v = CFPreferencesCopyValue('NSNavLastRootDirectory', 'com.apple.Finder', kCFPreferencesCurrentUser, kCFPreferencesAnyHost)
print(v)
# Writing a preferences value
@mosen
mosen / autotimezone.m
Last active November 9, 2016 23:14 — forked from pudquick/autotimezone.py
Forcing automatic timezone discovery with pyobjc on OS X
# Tested on 10.11
# Assumes your network is in a state to actually do the discovery and that you have
# automatic timezone discovery enabled in Date & Time and Location services enabled
# (Generally this means wifi enabled on your device and network stack is up)
# For enabling location services and auto, check Allister's work here:
# https://gist.github.com/arubdesu/b72585771a9f606ad800
#import <Foundation>
from ctypes import CDLL, Structure, POINTER, c_char_p, c_size_t, c_void_p, c_uint32, pointer, byref
Security = CDLL('/System/Library/Frameworks/Security.framework/Versions/Current/Security')
class OpaqueType(Structure):
pass
OpaqueTypeRef = POINTER(OpaqueType)
AuthorizationRef = OpaqueTypeRef
@mosen
mosen / yui3-netbeans7-code-templates
Created April 15, 2011 05:43
A selection of code templates to use for YUI3 with NetBeans 7.0RC2
The code under the headings should be inserted for the abbreviation stated. Trying to find a better way to export this.
yattr
-----
/**
* ${cursor}
*
* @attribute ${name}
* @type ${type}