Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View lexrus's full-sized avatar
🏠
Working from home

Lex Tang lexrus

🏠
Working from home
View GitHub Profile
@lexrus
lexrus / WTF_YOU_MUST_UPGRADE_COCOAPODS.sh
Created May 28, 2014 10:34
Force your little brother to upgrade CocoaPods.
NEW_VER="0.33.1"
POD_VER=`pod --version 2>/dev/null`|| POD_VER=`~/.rbenv/shims/pod --version 2>/dev/null`
if [[ "$POD_VER" != *$NEW_VER ]]; then
echo "error: WTF! You MUST upgrade cocoapods!!!"
exit 1
fi
@lexrus
lexrus / chinadns.conf
Created July 23, 2014 02:18
supervisor config for chinadns
[program:chinadns]
command=/usr/local/bin/chinadns
numprocs=1
autostart=true
autorestart=unexpected
startsecs=2
startretries=3
stdout_logfile=/var/log/chinadns.log
stdout_logfile_maxbytes=2MB
stderr_logfile=/var/log/chinadns.error.log
@lexrus
lexrus / svg2png.sh
Created March 31, 2015 06:39
Convert svg files to png.
for f in *.svg; do cairosvg $f -f png -o $f.png; done
@lexrus
lexrus / Deliverfile.rb
Created April 3, 2015 08:57
Universal Change Log
changelog({
"cmn-Hans" => "感谢使用 VPN On!为改善用户使用体验,我们每隔一周就会在 App Store 更新应用。你可以前往手机“设置”>“iTunes 与 App Store”>“自动下载的项目”,打开“更新”。\n\nVPN On 应用的每次更新都会改进速度和稳定性。一有新功能推出,我们会在应用中提示你。",
"cmn-Hant" => "感謝使用 VPN On!爲改善用戶使用體驗,我們每隔一週就會在 App Store 更新應用。你可以前往手機“設置”>“iTunes 與 App Store”>“自動下載的項目”,打開“更新”。\n\nVPN On 應用的每次更新都會改進速度和穩定性。一有新功能推出,我們會在應用中提示你。",
"ja-JP" => "VPN Onをご利用いただきありがとうございます。VPN Onではアプリをより快適にご利用いただくため、アプリストアで隔週でアップデートを行っております。[設定] > [iTunes & App Store] > [自動ダウンロード]でアップデートをオンにすることで、自動的に(このページにアクセスすることなく)アプリをアップデートいただけます。 \n\nVPN Onアプリのアップデートではスピードと信頼性の向上が行われており、また新しい機能が追加されると、アプリ内でその機能がハイライトされます。",
"it-IT" => "Grazie di usare VPN On! Per migliorare la nostra applicazione, pubblichiamo aggiornamenti nell'App Store ogni 2 settimane. Puoi aggiornare l'applicazione automaticamente (senza dover tornare qui) accedendo a Impostazioni > iTunes Store e App Store > Download automatici e attivando Aggiornamenti. \n\nOgni aggiornamento della nostra applicazione VPN On presenta miglioramenti relativi a velocità e aff
@lexrus
lexrus / tc
Created March 15, 2012 03:43
Epoch / Unix Timestamp Converter
#!/bin/bash
# sudo chmod +x tc;sudo mv tc /usr/bin
if [[ -z "$1" ]]
then
printf %s "\
Nifty Timestamp Convertor by Lex Tang
tc 2012/12/12
tc 1355283413
"
exit
@lexrus
lexrus / NSLogger+TestFlight.h
Created March 19, 2012 09:09
NSLogger+TestFlight Macros with remote log trigger
#pragma mark - NSLogger+TestFlight
#ifdef ADHOC
#import "TestFlight.h"
#define LOG_NETWORK(level, format, ...) TFLog((@"%s [Line %d] " format), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#define LOG_GENERAL(level, format, ...) TFLog((@"%s [Line %d] " format), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#define LOG_GRAPHICS(level, format, ...) TFLog((@"%s [Line %d] " format), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#define LOG_MEMORY(level, format, ...) TFLog((@"%s [Line %d] " format), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#define LOG_IMAGE(level, format, ...) do{}while(0)
#else
#if 0 // REMOTE LOG
@lexrus
lexrus / Makefile
Created March 30, 2012 08:59 — forked from hiroshi/Makefile
Makefile for Testflight upload
# Testflight web interface doesn't allow input non-ASCII characters (e.g. Japanese) with Safari!
BROWSER = Safari
TESTFLIGHT_TEAM_TOKEN_FILE = ./.testflight_team_token
TESTFLIGHT_TEAM_TOKEN_URL = https://testflightapp.com/dashboard/team/edit/?next=/api/doc/
TESTFLIGHT_TEAM_TOKEN = $(shell cat $(TESTFLIGHT_TEAM_TOKEN_FILE))
TESTFLIGHT_API_TOKEN_FILE = ~/.testflight_api_token
TESTFLIGHT_API_TOKEN_URL = https://testflightapp.com/account/\#api-token
TESTFLIGHT_API_TOKEN = $(shell cat $(TESTFLIGHT_API_TOKEN_FILE))
TESTFLIGHT_NOTES = 'This build was uploaded via the upload API'
#TESTFLIGHT_OTHER_OPTIONS = -F replace=True
@lexrus
lexrus / appstore.sh
Created October 22, 2012 10:39
Switch keychains for InHouse & AppStore while both certifications have the same name
#!/bin/bash
export MM_KEYCHAIN=(~/Dropbox/mm.keychain)
export MM_INHOUSE_KEYCHAIN=(~/Dropbox/mm_inhouse.keychain)
cp "$MM_INHOUSE_KEYCHAIN" "$MM_INHOUSE_KEYCHAIN.ori"
security delete-keychain "$MM_INHOUSE_KEYCHAIN"
if [[ -f "$MM_KEYCHAIN.ori" ]]; then
@lexrus
lexrus / build.py
Last active October 13, 2015 07:08 — forked from rjyo/build.py
OTA builder
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import json
import getopt
import urllib2
import commands
import string
@lexrus
lexrus / UIWindow+FLEX.swift
Created November 6, 2015 10:17
Toggle FLEX explorer with multi touch
//
// UIWindow+FLEX.swift
//
// Created by Lex on 11/6/15.
// Copyright © 2015 lexrus.com. All rights reserved.
//
import UIKit
#if DEBUG