Skip to content

Instantly share code, notes, and snippets.

@ooopscc
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/".
hook_type=${BASH_SOURCE##*/}
@ooopscc
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
hs.notify.show('Wi-Fi changed to ' .. (ssid), '', '')
View Disable Device Enrollment Program (DEP) notification on macOS Catalina.md

Disable Device Enrollment Program (DEP) notification on macOS Catalina.md

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
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
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: https://gist.github.com/steipete/7e3c69b985165dc23c5ec169b857ff42 even more: https://pspdfkit.com/blog/2016/swifty-objective-c/ - ships in https://p…
View PSPDFGenerics.h
//
// PSPDFGenerics.h
// PSPDFFoundation
//
// PSPDFKit is the leading cross-platform solution for integrating PDFs into your apps: https://pspdfkit.com.
// Try it today using our free PDF Viewer app: https://pdfviewer.io/
//
// This file is MIT licensed.
/**
View ThreadSafeMutableArray.h
//
// Created on 2019/1/25.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface ThreadSafeMutableArray<ObjectType> : NSObject <NSFastEnumeration, NSCopying>
@ooopscc
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
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 http://ooopscc.com. All rights reserved.
//
#import <Foundation/Foundation.h>
#pragma mark - NSArray