Skip to content

Instantly share code, notes, and snippets.

View VincentSit's full-sized avatar

Vincent VincentSit

View GitHub Profile
@VincentSit
VincentSit / Show or Hide Xcode.scpt
Created January 21, 2021 13:10
AppleScript to Show or Hide Application. Launch it if not running.
set appName to "Xcode"
tell application appName
if it is not running then
activate
else
tell application "System Events"
set activeApp to name of first application process whose frontmost is true
if visible of application process appName is false or (not (exists (window 1 of process appName))) or (appName is not in activeApp) then
tell process "Dock"
@VincentSit
VincentSit / redis-expire.sh
Created April 15, 2020 14:47 — forked from fieg/redis-expire.sh
Set expire on large set of keys using pattern in Redis
#!/bin/bash
if [ $# -ne 4 ]
then
echo "Usage: $0 <host> <port> <pattern> <seconds>"
exit 1
fi
cursor=-1
keys=""
@VincentSit
VincentSit / build_android.sh
Created February 2, 2020 10:58
Shell script to build FFmpeg for Android.
#!/bin/bash
# 当前系统
HOST_TAG=darwin-x86_64
# 支持的 Android 最低系统版本
MIN=21
# NDK 根目录
NDK=$ANDROID_NDK_HOME
@VincentSit
VincentSit / X509.swift
Created June 8, 2019 14:15 — forked from bagpack/X509.swift
X.509/P12
enum X509Error: Error {
case certificateError(message: String)
case publicKeyError(message: String)
}
class X509 {
// A DER (Distinguished Encoding Rules) representation of an X.509 certificate.
let publicKey: SecKey
@VincentSit
VincentSit / v2ex.js
Created January 7, 2019 09:27
v2ex 批量点赞
var arr = new Array();
$('.thank').each(function() {
var str = $(this).attr('onclick');
if (str.indexOf("铜币") >= 0) {
var substr = str.match(/thankReply.*;/);
arr.push(substr.toString());
}
});
for (i = 0; i < arr.length; i++) {
eval(arr[i]);
@VincentSit
VincentSit / README.MD
Created December 29, 2018 17:14
手机号码正则表达式
@VincentSit
VincentSit / AutoHook.h
Created October 29, 2018 14:09 — forked from JohnCoates/AutoHook.h
Simple Objective-C Method Hooking
@protocol AutoHook <NSObject>
@required
+ (NSArray <NSString *> *)targetClasses;
@end
@VincentSit
VincentSit / change_swift_version.rb
Last active September 24, 2018 07:38
Change swift version base on podspec
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.name == 'Debug'
config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = '-Onone'
else
config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = '-Owholemodule'
end
change_directly = false
@VincentSit
VincentSit / Obfuscator.swift
Created January 14, 2018 13:02 — forked from DejanEnspyra/Obfuscator.swift
Obfuscation of hard-coded security-sensitive strings.
//
// Obfuscator.swift
//
// Created by Dejan Atanasov on 2017-05-31.
//
import Foundation
class Obfuscator: AnyObject {
@implementation UIFont (PSPDFAdditions)
// https://gist.github.com/nuthatch/7594460
static CGFloat PSPDFMultiplicatorForPreferredContentSize(void) {
CGFloat multiplicator = 1.f;
NSString *preferredTextStyle = UIApplication.sharedApplication.preferredContentSizeCategory;
if ([preferredTextStyle isEqualToString:UIContentSizeCategoryExtraSmall]) {
multiplicator = 0.9f;
}else if ([preferredTextStyle isEqualToString:UIContentSizeCategorySmall]) {
multiplicator = 0.95f;