Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Lex Tang lexrus

🏠
Working from home
Block or report user

Report or block lexrus

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lexrus
lexrus / gist:1834804
Created Feb 15, 2012
BundleFullVersion
View gist:1834804
NSString *appVersion = [NSString stringWithFormat:@"%@(%@)",
[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"],
[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]];
@lexrus
lexrus / asicon.sh
Created Mar 6, 2012
AppStore Icons Generator
View asicon.sh
#!/bin/bash
# According to https://developer.apple.com/library/ios/#qa/qa1686/_index.html
# Install ImageMagick with MacPort: sudo port install ImageMagick
convert $1 -resize 512x512 iTunesArtwork.png # Ad Hoc iTunes
convert $1 -resize 144x144 Icon-72@2x.png # Home screen for "The New iPad"
convert $1 -resize 114x114 Icon@2x.png # Home screen for Retina display iPhone/iPod
convert $1 -resize 72x72 Icon-72.png # App Store and Home screen on iPad
convert $1 -resize 58x58 Icon-Small@2x.png # Spotlight and Settings for Retina display
convert $1 -resize 57x57 Icon.png # Home screen on non-Retina iPhone/iPod
convert $1 -resize 50x50 Icon-Small-50.png # Spotlight on iPad 1/2
@lexrus
lexrus / tc
Created Mar 15, 2012
Epoch / Unix Timestamp Converter
View tc
#!/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 Mar 19, 2012
NSLogger+TestFlight Macros with remote log trigger
View NSLogger+TestFlight.h
#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 Mar 30, 2012 — forked from hiroshi/Makefile
Makefile for Testflight upload
View Makefile
# 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
View .gitignore
# Exclude the Podspecs
Pods/*
Podfile.lock
# Exclude any PSD/AI source
#*.psd
#*.ai
# Exclude generated files
VersionX-revision.h
@lexrus
lexrus / appstore.sh
Created Oct 22, 2012
Switch keychains for InHouse & AppStore while both certifications have the same name
View appstore.sh
#!/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 Oct 13, 2015 — forked from rjyo/build.py
OTA builder
View build.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import json
import getopt
import urllib2
import commands
import string
@lexrus
lexrus / FREEDOM.wsf
Created Dec 24, 2012
有些变态的公司不让员工安装一些 Windows 常用软件~ 这个脚本帮助你骗过运维的远程注册表扫描程序,“非法”安装一些应用。运行后会在桌面上生成已经安装的软件列表,选择哪些要假装删除,然后运行桌面上的这个脚本,运维就扫描不到了。
View FREEDOM.wsf
<job id="TheShawshankHammer">
<script language="JScript" id="env">
var fso = new ActiveXObject("Scripting.FileSystemObject");
var WshShell = WScript.CreateObject("WScript.Shell");
var deskPath = WshShell.SpecialFolders("Desktop");
var arg = WScript.Arguments;
var scriptPath = WScript.ScriptFullName.split('\\').slice(0, -1).join('\\') + '\\';
</script>
<script language="JScript" id="scan">
@lexrus
lexrus / muzix.html
Created Dec 24, 2012
My XLST table sorting demo. Required IE 5.0+
View muzix.html
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>LeXRus' CodeX | XMLDOM | Transform a XML file with XSLT &amp; XMLDOM</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script xmlns:query="http://query@LexTang.com/namespace/"><!--//XR.Web.Request.Query["expr.(string)"]
var from,num,select,order,sort;
from=parseInt(window.location.href.replace(/.*\?.*from=(\d+)\&?.*/i,"$1")).toString();
num=parseInt(window.location.href.replace(/.*\?.*num=(\d+)\&?.*/i,"$1")).toString();
select=window.location.href.replace(/.*\?.*select=([ \w@=\(\)\[\]\.\*\\\/]+).*/i,"$1").toString();//the Filter of strXPath
You can’t perform that action at this time.