Skip to content

Instantly share code, notes, and snippets.

@ytzong
ytzong / README.md
Created May 17, 2023 08:53 — forked from raecoo/README.md
Surge config

Install Configurations

  1. Create your own start.conf:
  2. Download rules.conf
  3. Tap start.conf in the configuration list, then tap Start button.

Update Rules

+ (void) downloadVideoFromURL: (NSString *) URL withProgress:(void (^)(CGFloat progress))progressBlock completion:(void (^)(NSURL *filePath))completionBlock onError:(void (^)(NSError *error))errorBlock
{
//Configuring the session manager
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];
//Most URLs I come across are in string format so to convert them into an NSURL and then instantiate the actual request
NSURL *formattedURL = [NSURL URLWithString:URL];
NSURLRequest *request = [NSURLRequest requestWithURL:formattedURL];
@ytzong
ytzong / mac.sh
Last active September 24, 2018 17:47
一些常用的 Mac 脚本
# App Store 开启 Degub 菜单
defaults write com.apple.appstore ShowDebugMenu -bool true
# 开启充电提示音
# defaults write com.apple.PowerChime ChimeOnAllHardware -bool true; open /System/Library/CoreServices/PowerChime.app &
# 关闭
# defaults write com.apple.PowerChime ChimeOnAllHardware -bool false;killall PowerChime
# 修复 sabma 速度慢的问题
printf '[default]\nsigning_required=no\n' | sudo tee /etc/nsmb.conf >/dev/null