Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Need Install NOMAD: gem install nomad-cli
# More About NOMAD http://nomad-cli.com
####### Configuration
# Directory Config
SOURCE_NAME="xxx" # Project Bundle name, commonly Project Name
TARGET_DIRECTORY="./xxx" # Target ipa and dSYM file Directoy
TARGET_NAME_PREFIX="xxx" # Target ipa and dSYM file name
#!/bin/bash
# This script automatically sets the version and short version string of
# an Xcode project from the Git repository containing the project.
#
# To use this script in Xcode 4, add the contents to a "Run Script" build
# phase for your application target.
set -o errexit
set -o nounset
@vclwei
vclwei / .vimrc
Created August 16, 2013 04:57
My vimrc
call pathogen#infect()
syntax on
filetype plugin indent on
set number
set hlsearch
highlight TabLine term=underline cterm=bold ctermfg=9 ctermbg=4
highlight TabLineSel term=bold cterm=bold ctermbg=Red ctermfg=yellow
:color blackboard
• tab - open the current directory in a new tab
• pfd - return the path of the frontmost Finder window
• pfs - return the current Finder selection
• cdf - cd to the current Finder directory
• pushdf - pushd to the current Finder directory
• quick-look - Quick Look a specified file
• man-preview - open a specified man page in Preview
• trash - move a specified file to the Trash
@vclwei
vclwei / UIDevice isJailBroken
Created August 1, 2013 05:26
Detect iDevice is JailBroken
@interface UIDevice (Helper)  
- (BOOL)isJailbroken;  
@end
@implementation UIDevice (Helper)  
- (BOOL)isJailbroken {  
  BOOL jailbroken = NO;  
  NSString *cydiaPath = @"/Applications/Cydia.app";  
  NSString *aptPath = @"/private/var/lib/apt/";  
  if ([[NSFileManager defaultManager] fileExistsAtPath:cydiaPath]) {  
@vclwei
vclwei / gist:5712660
Created June 5, 2013 09:11
Get External IP Address
+ (void)getExternalIP{
NSURLRequest *ipRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://checkip.dyndns.com"]];
NSURLResponse *ipResponse = nil;
NSError *ipError = nil;
NSData *ipData = [NSURLConnection sendSynchronousRequest:ipRequest
returningResponse:&ipResponse
error:&ipError];
NSString *ipInfo = [[[NSString alloc] initWithData:ipData encoding:NSUTF8StringEncoding] autorelease];
NSLog(@"ipInfo %@", ipInfo);
}
@vclwei
vclwei / gist:5712527
Created June 5, 2013 08:43
Get DNS Server IP
+ (NSString *) getDNSServers
{
NSMutableString *addresses = [[NSMutableString alloc]initWithString:@"DNS Addresses \n"];
res_state res = malloc(sizeof(struct __res_state));
int result = res_ninit(res);
if ( result == 0 )
{
@vclwei
vclwei / gist:5712390
Created June 5, 2013 08:17
Get LocalIPAddresses
+ (NSArray *)localIPAddresses
{
NSMutableArray *ipAddresses = [NSMutableArray array] ;
struct ifaddrs *allInterfaces;
// Get list of all interfaces on the local machine:
if (getifaddrs(&allInterfaces) == 0) {
struct ifaddrs *interface;
@vclwei
vclwei / gist:5711804
Last active December 18, 2015 02:29
Get iOS Device MacAddress
+ (NSString *)macAddress{
int mib[6];
size_t len;
char *buf;
unsigned char *ptr;
struct if_msghdr *ifm;
struct sockaddr_dl *sdl;
mib[0] = CTL_NET;
mib[1] = AF_ROUTE;