Skip to content

Instantly share code, notes, and snippets.

View VincentSit's full-sized avatar

Vincent VincentSit

View GitHub Profile
@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 / download_youku_playlist.py
Created August 17, 2018 19:37
Download youku video playlist. 批量下载优酷视频列表或保存列表视频链接.
#coding=utf-8
import os
import sys
import shlex
import requests
from bs4 import BeautifulSoup
# 前置
# 安装 you-get
@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;
@VincentSit
VincentSit / code.m
Created February 12, 2017 19:15
Upload data to QiNiu(qiniu.com) Raw
- (NSURLSessionUploadTask *)uploadData:(NSData *)data completionHandler:(HXFStringCompletionBlock)completionHandler {
NSParameterAssert(data);
NSMutableURLRequest *request = [[AFHTTPRequestSerializer serializer] multipartFormRequestWithMethod:@"POST"
URLString:@"http://upload.qiniu.com"
parameters:@{@"token": self.uploadToken}
constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
[formData appendPartWithFileData:data name:@"file" fileName:@"?" mimeType:@"image/jpeg"];
} error:nil];
@VincentSit
VincentSit / bcastpacket.m
Created December 26, 2016 08:19 — forked from chrishulbert/bcastpacket.m
Send a broadcast udp message using c / obj-c
#include <netinet/in.h>
#include <sys/socket.h>
#include <unistd.h>
#include <arpa/inet.h>
- (void)sendBroadcastPacket {
// Open a socket
int sd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (sd<=0) {
NSLog(@"Error: Could not open socket");