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 / asicon.sh
Created March 6, 2012 08:48
AppStore Icons Generator
#!/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 [email protected] # Home screen for "The New iPad"
convert $1 -resize 114x114 [email protected] # 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 [email protected] # 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 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 / .gitignore
Created April 10, 2012 05:13
.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 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 / FREEDOM.wsf
Created December 24, 2012 06:29
有些变态的公司不让员工安装一些 Windows 常用软件~ 这个脚本帮助你骗过运维的远程注册表扫描程序,“非法”安装一些应用。运行后会在桌面上生成已经安装的软件列表,选择哪些要假装删除,然后运行桌面上的这个脚本,运维就扫描不到了。
<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 December 24, 2012 08:22
My XLST table sorting demo. Required IE 5.0+
<?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://[email protected]/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
@lexrus
lexrus / vim.rb
Last active December 14, 2015 01:59 — forked from uasi/vim.rb
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
url 'ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2'
head 'https://vim.googlecode.com/hg/'
sha256 '5c5d5d6e07f1bbc49b6fe3906ff8a7e39b049928b68195b38e3e3d347100221d'
version '7.3.682'
def features; %w(tiny small normal big huge) end