Skip to content

Instantly share code, notes, and snippets.

@S1U
S1U / SecondViewController.h
Created November 23, 2014 08:12
background color disappeared
#import <UIKit/UIKit.h>
@interface SecondViewController : UIViewController
@end
@S1U
S1U / Xcode 自动版本号
Last active August 31, 2015 12:42
Auto incremental build number
#Xcode 自动版本号
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion `git rev-list HEAD | wc -l | awk '{print $1}'`" "$INFOPLIST_FILE"
@S1U
S1U / Surge.conf
Last active October 26, 2015 06:13
[General]
# warning, notify, info, verbose
loglevel = notify
bypass-system = true
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, localhost, *.local
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
dns-server = 114.114.114.114,119.29.29.29,8.8.8.8
[Proxy]
# http, https, socks5
[General]
loglevel = notify
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, localhost, *.local
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
[Proxy]
Proxy = custom, 1.2.3.4, 443, rc4-md5, password, http://surge.run/SSEncrypt.module
[Rule]
DOMAIN-KEYWORD,google,Proxy,force-remote-dns
#/etc/security/limits.conf
* soft nofile 51200
* hard nofile 51200
#/etc/sysctl.conf
# max open files
fs.file-max = 51200
# max read buffer
net.core.rmem_max = 67108864
# max write buffer
net.core.wmem_max = 67108864
# default read buffer
net.core.rmem_default = 65536
# default write buffer
@S1U
S1U / AdaptiveFont.swift
Last active April 7, 2016 09:27
Adaptive font fits to height of UILabel, UITextView
// Inspired from
// http://stackoverflow.com/a/26221732/2438676
// http://derekneely.com/tag/resize-text/
// http://stackoverflow.com/a/27115350/2438676
import UIKit
extension UIFont {
class func adaptiveFontWithName(fontName: String, label: UILabel, minSize: CGFloat = 9, maxSize: CGFloat = 999) -> UIFont! {
// http://stackoverflow.com/questions/24755558/measure-elapsed-time-in-swift
let begin = NSDate()
print(begin)
let elapsedTime = timeIntervalSinceDate(begin)
let elapsedTime2 = begin.timeIntervalSinceNow
@S1U
S1U / render28.py
Last active June 8, 2022 00:57 — forked from cloutsocks/render.py
GPU rendering script for Blender 2.8
import bpy
# Mark all scene devices as GPU for cycles
bpy.context.scene.cycles.device = 'GPU'
print("--------------- SCENE LIST ---------------")
for scene in bpy.data.scenes:
print(scene.name)
scene.cycles.device = 'GPU'
scene.render.resolution_percentage = 200