Skip to content

Instantly share code, notes, and snippets.

View pupboss's full-sized avatar

Jie Li pupboss

View GitHub Profile
@pupboss
pupboss / DeviceExtension.swift
Last active August 29, 2015 14:18
get device model swift
// MARK: UIDeveice 扩展
let deviceList = [
"iPhone1,1": "iPhone 2G (A1203)",
"iPhone1,2": "iPhone 3G (A1241/A1324)",
"iPhone2,1": "iPhone 3GS (A1303/A1325)",
"iPhone3,1": "iPhone 4 (A1332)",
"iPhone3,2": "iPhone 4 (A1332)",
"iPhone3,3": "iPhone 4 (A1349)",
"iPhone4,1": "iPhone 4S (A1387/A1431)",
@pupboss
pupboss / afn-custom-header.m
Created April 13, 2015 11:55
AFN 框架 自定义请求头
// 1.创建请求管理对象
AFHTTPRequestOperationManager *mgr = [AFHTTPRequestOperationManager manager];
[mgr.requestSerializer setValue:@"6defcbc5-69cf-4d4b-9345-00ad9fa97db4" forHTTPHeaderField:@"Authorization"];
[mgr GET:@"http://l*******/~self" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"%@",responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
}];
@pupboss
pupboss / main.cpp
Created May 21, 2015 16:30
Block-Test
This file has been truncated, but you can view the full file.
#ifndef __OBJC2__
#define __OBJC2__
#endif
struct objc_selector; struct objc_class;
struct __rw_objc_super {
struct objc_object *object;
struct objc_object *superClass;
__rw_objc_super(struct objc_object *o, struct objc_object *s) : object(o), superClass(s) {}
};
#ifndef _REWRITER_typedef_Protocol
@pupboss
pupboss / proxy.pac
Last active September 8, 2015 03:05
pac with squid/squid3 of gfw list
/**
* genpac 1.3.0 https://github.com/JinnLynn/genpac
* Generated: Tue, 08 Sep 2015 03:03:32 GMT
* GFWList Last-Modified: Wed, 19 Aug 2015 22:44:03 -0400
* GFWList From: online[https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt]
*/
var proxy = "PROXY 128.xx.1xx.xx:21;";
var rules = [
@pupboss
pupboss / blog.py
Created March 5, 2016 11:35
All Ghost article to Hexo md
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sqlite3
import time, datetime
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
cx = sqlite3.connect("/path/to/ghost.db")
@pupboss
pupboss / .surge.conf
Last active April 5, 2016 09:40
Surge For iOS & Mac Config Files
[General]
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local
bypass-tun = 0.0.0.0/8, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
loglevel = notify
interface = 0.0.0.0
port = 1080
[Proxy]
DIRECT = direct
ruleSets:
- name: Potatso
rules:
# Default
- DOMAIN-SUFFIX,apple.com,DIRECT
- DOMAIN-SUFFIX,icloud.com,DIRECT
- DOMAIN-SUFFIX,itunes.com,DIRECT
# Proxy
- DOMAIN-SUFFIX,100lu.com,Proxy
@pupboss
pupboss / byebye.js
Last active December 29, 2016 12:58
一键删除知乎关注话题
var jq = document.createElement('script');
jq.src = "https://res.wx.qq.com/open/libs/jquery/2.1.4/jquery.js";
document.getElementsByTagName('head')[0].appendChild(jq);
$("a.TopicLink.PortraitItem-image").each(function(){
var num = this.href.replace('https://www.zhihu.com/topic/', '');
var remoteUrl = 'https://www.zhihu.com/api/v4/topics/' + num + '/followers';
$.ajax({
@pupboss
pupboss / oclint.sh
Created August 11, 2017 06:56
Script integrating OCLint into XCode. Put it in "Run script" build phase.
source ~/.bash_profile
cd ${SRCROOT}
xcodebuild -scheme <projectName> -workspace <projectName>.xcworkspace clean
xcodebuild -scheme <projectName> -workspace <projectName>.xcworkspace | xcpretty -r json-compilation-database --output compile_commands.json
oclint-json-compilation-database -exclude Pods -exclude build -exclude Internal -exclude ThirdParties -- -report-type xcode
@pupboss
pupboss / README.md
Created September 6, 2018 05:08
Robo3T on Ubuntu

Copied from https://gist.github.com/MatthewBooth/4374397107d1b05fd1f28e1e6dfbbefa , for backup use

  • Download the Binary from the official Robo3t Website.
  • Extract the archive to /opt/robo3t. You may need root permissions to do this.
  • Set the permissions to the current user sudo chown -R ${whoami}:${whoami} /opt/robo3t
  • Download this image http://blog.robomongo.org/content/images/2016/01/enjoy.png and save to /opt/robo3t/bin/robo3t.png
  • Make the binary executable sudo chmod +x /opt/robo3t/bin/robo3t
  • Create a desktop file and copy in the contents below. Call it robo3t.desktop.
  • Install this file using sudo desktop-file-install ~/Downloads/robo3t.desktop replacing ~/Downloads with the location you created the file