Skip to content

Instantly share code, notes, and snippets.


Shengzhi.Chen chenshengzhi

  • Xiamen, Fujian, China
View GitHub Profile
JunyuKuang / OverrideCatalystScaleFactor.swift
Created November 20, 2021 04:06
Disable 77% scaling for Mac Catalyst apps. (Swift) (Works on macOS 12)
View OverrideCatalystScaleFactor.swift
let overrideCatalystScaleFactor: Void = {
guard let sceneViewClass = NSClassFromString("UINSSceneView") as? NSObject.Type else {
if sceneViewClass.instancesRespond(to: NSSelectorFromString("scaleFactor")) {
// old
class: sceneViewClass,
originalSelector: NSSelectorFromString("scaleFactor"),
swizzledSelector: #selector(swizzle_scaleFactor)
magicdude4eva / zsh-syntax-highlighting paste performance improvement
Last active May 31, 2023 10:56
zsh-syntax-highlighting paste performance improvement
View zsh-syntax-highlighting paste performance improvement
Add the following in .zshrc:
plugins=(osx git zsh-autosuggestions zsh-syntax-highlighting zsh-nvm docker kubectl)
### Fix slowness of pastes with zsh-syntax-highlighting.zsh
pasteinit() {
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
dannote / final-cut-pro-trial-reset.swift
Last active June 6, 2023 16:16
Final Cut Pro X trial reset
View final-cut-pro-trial-reset.swift
import Foundation
let path = URL(fileURLWithPath: NSString(string: "~/Library/Application Support/.ffuserdata").expandingTildeInPath)
let data = try! NSData(contentsOf: path) as Data
let dictionary = try! NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(data) as! NSDictionary
let mutableDictionary = dictionary.mutableCopy() as! NSMutableDictionary
for (key, value) in mutableDictionary {
idleberg /
Last active March 2, 2023 15:50 — forked from vincentmac/
“Open in Sublime Text” in macOS context-menu

This list has been updated for Big Sur (and later). Since I don't use these versions, this guide might still need further improvements. For older macOS versions, please see this older revision.

Open in Sublime Text

  • Open Automator
  • Quick Action
  • Set “Service receives selected” to files or folders in any application
  • Add a Run Shell Script action
  • Set the script action to /Applications/Sublime\ -n "$@"
  • Set “Pass input” to as arguments
anonymous /
Created July 16, 2016 04:04
# Compile-Freetype-For-iOS
# Original Script
# Revised by: l'L'l
# New Features Include: auto download latest version, fixed toolchain locations, other various tweeks
# The MIT License (MIT)
# Copyright (c) 2016 l'L'l
paulirish / open-chrome-tabs-in-safari.scpt
Created April 4, 2016 00:24
open chrome tabs in safari
View open-chrome-tabs-in-safari.scpt
tell application "Google Chrome"
set tab_list to every tab in the front window
repeat with the_tab in tab_list
set the_url to the URL of the_tab
tell application "Safari" to open location the_url
end repeat
end tell
evantoli /
Last active June 6, 2023 10:58
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

Ashton-W / Breakpoints_v2.xcbkptlist
Last active January 25, 2023 09:28
My User Breakpoints_v2.xcbkptlist
View Breakpoints_v2.xcbkptlist
<?xml version="1.0" encoding="UTF-8"?>
type = "2"
version = "2.0">
<!-- All Exceptions -->
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
jspahrsummers / GHRunLoopWatchdog.h
Created January 28, 2015 20:50
A class for logging excessive blocking on the main thread
View GHRunLoopWatchdog.h
/// Observes a run loop to detect any stalling or blocking that occurs.
/// This class is thread-safe.
@interface GHRunLoopWatchdog : NSObject
/// Initializes the receiver to watch the specified run loop, using a default
/// stalling threshold.
- (id)initWithRunLoop:(CFRunLoopRef)runLoop;
/// Initializes the receiver to detect when the specified run loop blocks for
View git 设置和取消代理
git config --global https.proxy
git config --global https.proxy
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy