Skip to content

Instantly share code, notes, and snippets.

ooopscc / git-multi-hook-template
Created Dec 23, 2020 — forked from damienrg/git-multi-hook-template
Script to allow multi hooks per hook type for git
View git-multi-hook-template
#!/usr/bin/env bash
# Allow multiple hooks.
# To use it copy this script with executable permission in ".git/hooks/hook-name"
# where hook-name is the name of the hook (see man githooks to know available hooks).
# Then place your scripts with executable permission in ".git/hooks/hook-name.d/".
ooopscc / WiFiChange.lua
Created Sep 11, 2020
WiFi Change Action
View WiFiChange.lua
local prevSSID = 'NO_NET'
function ssidChangedCallback()
local ssid = hs.wifi.currentNetwork()
if ssid ~= nil then
print(prevSSID .. " -> " .. ssid)
if ssid ~= nil and ssid ~= prevSSID then
prevSSID = ssid'Wi-Fi changed to ' .. (ssid), '', '')
View Disable Device Enrollment Program (DEP) notification on macOS

Disable Device Enrollment Program (DEP) notification on macOS

With full reinstall (recommended)

   a. Boot into recovery using command-R during reboot, wipe the harddrive using Disk Utility, and select reinstall macOS

   b. Initial installation will run for approximately 1 hour, and reboot once

   c. It will then show a remaining time of about 10-15 minutes

ooopscc / karabiner_switch_input_source.json
Created May 24, 2019 — forked from gxfxyz/karabiner_switch_input_source.json
Karabiner-Elements config: switch input source | 输入法切换
View karabiner_switch_input_source.json
"title": "Switch input source | 输入法切换",
"rules": [
"description": "Tap Command_L (⌘) → Switch input source to English | 短按左 Command (⌘) → 切换到英文输入法",
"manipulators": [
"conditions": [
"input_sources": [
ooopscc / PSPDFGenerics.h
Created Mar 15, 2019 — forked from steipete/PSPDFGenerics.h
Override copy and mutableCopy on Objective-C collection classes to pass along both the collection type and the generic info. This is a header-only "library". MIT licensed. Craving for more? foreach: even more: - ships in https://p…
View PSPDFGenerics.h
// PSPDFGenerics.h
// PSPDFFoundation
// PSPDFKit is the leading cross-platform solution for integrating PDFs into your apps:
// Try it today using our free PDF Viewer app:
// This file is MIT licensed.
View ThreadSafeMutableArray.h
// Created on 2019/1/25.
#import <Foundation/Foundation.h>
@interface ThreadSafeMutableArray<ObjectType> : NSObject <NSFastEnumeration, NSCopying>
ooopscc / PSPDFThreadSafeMutableDictionary.m
Created Jan 25, 2019 — forked from steipete/PSPDFThreadSafeMutableDictionary.m
Simple implementation of a thread safe mutable dictionary. In most cases, you want NSCache instead, but it can be useful in situations where you want to manually control what is evicted from the cache in low memory situations.**Warning:** I only use this for setting/getting keys. Enumeration is not thread safe here and will still throw exception…
View PSPDFThreadSafeMutableDictionary.m
// PSPDFThreadSafeMutableDictionary.m
// Copyright (c) 2013 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
// 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
View ArrayHelpers.swift
extension Array {
func first() -> Element? {
if isEmpty {
return nil
return self[0]
func last() -> Element? {
ooopscc / CCDeepCopy.h
Created Dec 8, 2014
Deep Copy Categories for NSArray & NSDictionary
View CCDeepCopy.h
// CCDeepCopy.h
// Created by ooops on 12/8/14.
// Copyright (c) 2014 All rights reserved.
#import <Foundation/Foundation.h>
#pragma mark - NSArray