Skip to content

Instantly share code, notes, and snippets.

View hewigovens's full-sized avatar
🐛
Fixing

Tao Xu hewigovens

🐛
Fixing
View GitHub Profile
@hewigovens
hewigovens / daily_integration.bat
Created September 4, 2011 12:38
perforce auto integration
@echo off
echo setting perforce env ...
rem set below variables in conformity with your environments.
set P4PORT=
set P4_HOME=
set REMOTE_DEV_TREE=
set REMOTE_INT_TREE=
set LOCAL_DEV_TREE=
@hewigovens
hewigovens / stat_goagent.sh
Created October 6, 2011 07:57
Simple script for goagent statistic
#!/bin/bash
python_count=0
toggle_count=0
local_count=0
log_list=$(ls /etc/httpd/logs/access_log*)
for log in $log_list
do
tmp=$(cat $log | grep python | wc -l)
@hewigovens
hewigovens / rename.sh
Created November 8, 2011 01:04
Rename files
#!/bin/bash
for f in *.jpg
do
mv $f "`basename $f .jpg`_en.jpg"
done
@hewigovens
hewigovens / daily_integration.sh
Created April 12, 2012 01:58
perforce auto integration shell
echo "setting perforce env..."
export P4PORT=
export P4EDITOR=vim
export P4PASSWD=
export P4USER=
export P4CLIENT=
REMOTE_DEV_TREE=
REMOTE_INT_TREE=
@hewigovens
hewigovens / short_url_resolve.c
Created May 9, 2012 06:08
resolve short url
#include <stdio.h>
#include <curl/curl.h>
int main(void)
{
CURL *curl;
CURLcode ret;
char* resolved_url = NULL;
curl = curl_easy_init();
if(curl)
@hewigovens
hewigovens / install-sdk
Last active December 13, 2015 19:48 — forked from rpetrich/install-sdk
#!/bin/sh
SDK=`dirname $0`
SCRIPT=`basename $0`
SDKPARENT=`dirname $SDK`
DEVROOT=`xcode-select --print-path`
SDKVER=`xcodebuild -showsdks | grep iphoneos | awk '{print $2}' | tail -n 1`
SDKROOT="$DEVROOT/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS$SDKVER.sdk"
SDKsROOT="$DEVROOT/Platforms/iPhoneOS.platform/Developer/SDKs"
PLATFORM=`uname -sp`
@hewigovens
hewigovens / clean_sdk_gcc.sh
Created October 17, 2013 04:34
Remove SDK/GCC/DeployTarget settings from legacy Xcode projects
#!/bin/sh
find . -name "*.pbxproj" -exec sed -i "*.bak" '/GCC_VERSION/d' {} \;
find . -name "*.pbxproj" -exec sed -i "*.bak" '/SDKROOT =/d' {} \;
find . -name "*.pbxproj" -exec sed -i "*.bak" '/MACOSX_DEPLOYMENT_TARGET =/d' {} \;
@hewigovens
hewigovens / get_disk_sn.m
Last active January 2, 2016 09:09
Get internal disk serial number
NSString* getInternalDiskSN()
{
NSString* result = @"";
CFMutableDictionaryRef matching;
matching = IOServiceMatching("IOAHCIBlockStorageDevice");
io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, matching);
if (service) {
CFMutableDictionaryRef properties = NULL;
@hewigovens
hewigovens / link_derived_folder.sh
Last active May 15, 2020 02:33
symlink derived data path in Xcode build phase
@hewigovens
hewigovens / main.c
Last active May 15, 2020 02:33
get executable path from libproc
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <libproc.h>
int main (int argc, char* argv[])
{
int ret;
pid_t pid;