View update_settings_version.sh
#!/bin/bash
PLISTBUDDY="/usr/libexec/PlistBuddy"
INFO_PLIST="$CODESIGNING_FOLDER_PATH/Info.plist"
SETTINGS_PLIST="$CODESIGNING_FOLDER_PATH/Settings.bundle/Root.plist"
VERSION_NUMBER="`$PLISTBUDDY -c \"Print CFBundleShortVersionString\" \"$INFO_PLIST\"`"
BUILD_NUMBER="`$PLISTBUDDY -c \"Print CFBundleVersion\" \"$INFO_PLIST\"`"
VERSION="Version $VERSION_NUMBER ($BUILD_NUMBER)"
GROUP_INDEX="`xmllint --xpath \"count(//array/dict)-1\" \"$SETTINGS_PLIST\"`"
$PLISTBUDDY -c "Set :PreferenceSpecifiers:$GROUP_INDEX:Title '$VERSION'" "$SETTINGS_PLIST"
View CollectionOperator.swift
import Foundation
enum CollectionOperator: String {
case avg
case count
case max
case min
case sum
View enable-von-forward-nat.sh
#
# https://roelant.net/2015/share-your-vpn-mac-el-capitan.html
sleep 15
#
/usr/sbin/sysctl -w net.inet.ip.fw.enable=1
/usr/sbin/sysctl -w net.inet.ip.forwarding=1
/usr/sbin/sysctl -w net.inet6.ip6.forwarding=1
pfctl -d
pfctl -f /Users/lex/Dropbox/openvpn/pf.conf -e
View enable_disqus_for_ghost_casper_theme.html
<script>
(function(disqusid) {
var d=document,sections=document.getElementsByTagName("section")
for(var i=0;i<sections.length;i++){
if(sections[i].className=='share'){
var div=d.createElement('div');
div.setAttribute('id','disqus_thread');
sections[i].parentNode.appendChild(div);
var s=d.createElement('script');
s.src='//'+disqusid+'.disqus.com/embed.js';
View BackgroundHint.m
//
// BackgroundHint.m
// Zus
//
// Created by Lex on 4/13/16.
// Copyright © 2016 lex.sh. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
View dnspod-ddns.py
#!/usr/bin/env python
# -*- coding=utf-8 -*-
# Author: 易思龙 <ixxoo.me@gmail.com>
# Create: 2015-09-05
import time
import json
import urllib
import urllib2
View patch001.lua
luaSetWaxConfig({openBindOCFunction="true"})
waxClass{"Zus.SettingVC"}
function viewDidLoad(self)
print("lua viewDidLoad");
self:ORIGviewDidLoad();
self:setTitle("Wax-patched " .. wax.appVersion)
end
View swift-interview-outline.md
  • Array 是 value type,使用 structs 实现
  • 数据类型没有隐式转换
  • 对于 String,count() 的复杂度是 O(n),每一个 Character 都是 unicode scalars 的序列
  • raw values 和 associated values 的区别
  • 如果必要,对于实现了 _ObjectiveCBridgeable 的 value types 会被自动桥接成 reference types
  • 讲一下 unowned 和 weak 的区别
  • 改 struct 的属性的方法名前要加 mutating,但如果这个 struct 用 let 声明的,改不了。修正:网友指出用 nonmutating set 也可以改属性。
  • nil 和 .None 的区别
  • capture list in closure
  • 举一个 guard ... where 的例子
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/vivid64"
# config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.synced_folder "./code", "/code"
config.vm.provider "virtualbox" do |vb|
vb.gui = false
View QNUploader.swift
//
// QNUploader.swift
//
// Created by Lex on 12/1/15.
//
import Foundation
import Alamofire
private let kCDNDomain = "__YOUR_QINIU_CDN_DOMAIN__"