Skip to content

Instantly share code, notes, and snippets.

//
// NSObject+BlockObservation.h
// Version 1.0
//
// Andy Matuschak
// [email protected]
// Public domain because I love you. Let me know how you use it.
//
#import <Cocoa/Cocoa.h>
GSEventType eventType = GSEventGetType((GSEventRef)event);
GSEventFlags modFlag = GSEventGetModifierFlags((GSEventRef)event);
UniChar keyCode = GSEventGetKeyCode((GSEventRef)event);
NSLog(@"----------event: %d", eventType);
NSLog(@"----------modifier: %d", modFlag);
NSLog(@"----------keycode: %d", keyCode);
uint fCTRL = (modFlag & 1048576) ? YES : NO;
uint fSHIFT = (modFlag & 131072) ? YES : NO;
uint fALT = (modFlag & 524288) ? YES : NO;
uint fCMD = (modFlag & 65536) ? YES : NO;
import Cocoa
import MASShortcut
func pow() {
let rect = NSScreen.mainScreen()?.frame
let window = NSWindow(contentRect: rect!, styleMask: NSBorderlessWindowMask, backing: .Buffered, `defer`: false)
window.backgroundColor = NSColor.clearColor()
window.opaque = false
window.alphaValue = 1
window.makeKeyAndOrderFront(NSApplication.sharedApplication())
@0xjac
0xjac / private_fork.md
Last active November 20, 2024 15:14
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare [email protected]:usi-systems/easytrace.git

@rmcdongit
rmcdongit / macOS_SytemPrefs.md
Last active November 20, 2024 12:23
Apple System Preferences URL Schemes

macOS 10.15 System Preference Panes

Below are a list of System Preference pane URLs and paths that can be accessed with scripting to assist users with enabling macOS security settings without having to walk them through launching System Preferences, finding panes, and scrolling to settings. Not all panes have an accessible anchor and some are OS specific.

To find the Pane ID of a specific pane, open the System Preferences app and select the desired Preference Pane. With the pane selected, open the ScriptEditor.app and run the following script to copy the current Pane ID to your clipboard and display any available anchors:

tell application "System Preferences"
	set CurrentPane to the id of the current pane
	set the clipboard to CurrentPane