Skip to content

Instantly share code, notes, and snippets.

View Kingson's full-sized avatar
🎯
Focusing

Kingson Zhou Kingson

🎯
Focusing
  • ButtonSoftware
  • China
View GitHub Profile
@imbyron
imbyron / weather.py
Last active August 23, 2017 15:37
拙作:利用国家气象局的API查询天气的工具。
#!/usr/bin/python
#coding:utf-8
'''
@author:Byron
新浪微博:http://weibo.com/ziyuetk
'''
import urllib2, json
from city import city
yourcity = raw_input("你想查那个城市的天气?")
--- CCDevice.mm (revision 6)
+++ CCDevice.mm (working copy)
@@ -102,11 +102,12 @@
- (void)accelerometer:(CMAccelerometerData *)accelerometerData
{
- _acceleration->x = accelerometerData.acceleration.x;
- _acceleration->y = accelerometerData.acceleration.y;
- _acceleration->z = accelerometerData.acceleration.z;
- _acceleration->timestamp = accelerometerData.timestamp;
@selfboot
selfboot / coursera_download.py
Created September 2, 2014 12:47
批量下载Coursera上面的课程资源。使用时,我们只需要运行程序,并把课程名称作为参数传递给程序就可以了(这里的课程名称并不是整个课程的完整名字,而是在课程介绍页面地址中的缩略名字,比如Computer Networks这门课,课程名称是comnetworks-002)。
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import requests
from bs4 import BeautifulSoup
import codecs
import string
import random
import re
import getpass
@bang590
bang590 / linkmap.js
Last active August 6, 2024 14:59
XCode Linkmap Parser
var readline = require('readline'),
fs = require('fs');
var LinkMap = function(filePath) {
this.files = []
this.filePath = filePath
}
LinkMap.prototype = {
start: function(cb) {
@0xlitf
0xlitf / iOS jump URL
Created December 5, 2015 04:20
iOS跳到系统设置里的各种设置界面
NSURL *url = [NSURL URLWithString:@"prefs:root=LOCATION_SERVICES"];
if ([[UIApplication sharedApplication] canOpenURL:url])
{
[[UIApplication sharedApplication] openURL:url];
}
About — prefs:root=General&path=About
Accessibility — prefs:root=General&path=ACCESSIBILITY
Airplane Mode On — prefs:root=AIRPLANE_MODE
@KittenYang
KittenYang / UIGestureRecognizer+Block.m
Last active June 16, 2019 01:46
使用 Block 创建 UIGestureRecognizer
static const int target_key;
@implementation UIGestureRecognizer (Block)
+(instancetype)nvm_gestureRecognizerWithActionBlock:(NVMGestureBlock)block {
return [[self alloc]initWithActionBlock:block];
}
- (instancetype)initWithActionBlock:(NVMGestureBlock)block {
self = [self init];
[self addActionBlock:block];
@KittenYang
KittenYang / UIView+ExtendTouchRect.m
Created April 8, 2016 02:41
一行代码实现点击区域的扩大
void Swizzle(Class c, SEL orig, SEL new) {
Method origMethod = class_getInstanceMethod(c, orig);
Method newMethod = class_getInstanceMethod(c, new);
if (class_addMethod(c, orig, method_getImplementation(newMethod), method_getTypeEncoding(newMethod))){
class_replaceMethod(c, new, method_getImplementation(origMethod), method_getTypeEncoding(origMethod));
} else {
method_exchangeImplementations(origMethod, newMethod);
}
}
@VincentSit
VincentSit / update_gfwlist.sh
Last active October 14, 2024 09:52
Automatically update the PAC for ShadowsocksX. Only tested on OS X. (Deprecated)
#!/bin/bash
# update_gfwlist.sh
# Author : VincentSit
# Copyright (c) http://xuexuefeng.com
#
# Example usage
#
# ./whatever-you-name-this.sh
#
# Task Scheduling (Optional)
@rambolee
rambolee / how_to_fix_update_gwflist_404_error.md
Last active July 9, 2020 00:59
shadowSocks 从 gwflist更新 PAC 时404

shadowSocks 从 gwflist更新 PAC 时404

shadowSocks 从 gwflist更新 PAC 时404

问题:MacOS下ShadowsocksX点击“从GFWList更新PAC”报“Request failed : not found(404)”错误。 查看了 github 的 issue,发现是新问题,但是已经有大神解决了,解决方案如下。
下面是大神的 shell 代码,果断观摩之:

大神的 github 地址

var CryptoJS = require('crypto-js')
var request = require('request-promise')
/*
* npm install crypto-js request-promise request
* node wx_t1t_hack.js
*/
// export function testEncription(msg, fullKey) {
// var fullKey = fullKey.slice(0, 16)