Skip to content

Instantly share code, notes, and snippets.

View enefry's full-sized avatar

enefry

  • china.guangdong
View GitHub Profile
@enefry
enefry / nginx_install_script.sh
Last active September 12, 2017 10:07
nginx install script
echo "--------- Begin Nginx ---------"
echo "--------- install and update tools ---------"
#更新
yum -y update
#安装依赖,以及git
yum -y install gcc openssl-devel pcre-devel zlib-devel libtool gcc-c++ build-essential git make which wget
echo "--------- prepare files ---------"
if [ ! -d nginx ]; then
#ifdef _MSC_VER
#define snprintf(output,len,fmt,... ) sprintf_s(output,len,fmt,##__VA_ARGS__)
#endif // _MSC_VER
#ifdef DEBUG_DUMP_HEX_
#define DUMP_HEX_VVLOG printf("[%d]maxLen=%d offset=%d delta=%d \n",__LINE__,maxLen,offset,(maxLen-offset));
#else
#define DUMP_HEX_VVLOG
#endif
int DumpHex(char* buffer,int maxLen, const char* input, int len) {
@enefry
enefry / gist:a1a3104dade16308cc1eaf82d38efa1d
Created August 1, 2017 07:39 — forked from shazron/gist:943736
About XCode 4 Project Template (How To Create Custom Project Template)
From: http://snipt.net/yonishin/about-xcode-4-project-template
XCode 4 Projects and Files Template Folder: /Developer/Library/Xcode/Templates
Examples:
/Developer/Library/Xcode/Templates/Project Templates/Base/Other/Empty.xctemplate
/Developer/Library/Xcode/Templates/Project Templates/Base/Base.xctemplate
/Developer/Library/Xcode/Templates/Project Templates/Mac/Mac Base.xctemplate
/Developer/Library/Xcode/Templates/Project Templates/Mac/Application/Command Line Tool.xctemplate
/Developer/Library/Xcode/Templates/Project Templates/Mac/Application/Cocoa Application.xctemplate
@enefry
enefry / gist:dfb62b6bcb4b59dd690e9ba78f355953
Created August 1, 2017 07:39 — forked from shazron/gist:943736
About XCode 4 Project Template (How To Create Custom Project Template)
From: http://snipt.net/yonishin/about-xcode-4-project-template
XCode 4 Projects and Files Template Folder: /Developer/Library/Xcode/Templates
Examples:
/Developer/Library/Xcode/Templates/Project Templates/Base/Other/Empty.xctemplate
/Developer/Library/Xcode/Templates/Project Templates/Base/Base.xctemplate
/Developer/Library/Xcode/Templates/Project Templates/Mac/Mac Base.xctemplate
/Developer/Library/Xcode/Templates/Project Templates/Mac/Application/Command Line Tool.xctemplate
/Developer/Library/Xcode/Templates/Project Templates/Mac/Application/Cocoa Application.xctemplate
######################
# Options
######################
REVEAL_ARCHIVE_IN_FINDER=false
FRAMEWORK_NAME="${PROJECT_NAME}"
SIMULATOR_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${FRAMEWORK_NAME}.framework"
@enefry
enefry / generateRandomColor.swift
Created December 29, 2017 03:37 — forked from asarode/generateRandomColor.swift
Generating random UIColor in Swift
func generateRandomColor() -> UIColor {
let hue : CGFloat = CGFloat(arc4random() % 256) / 256 // use 256 to get full range from 0.0 to 1.0
let saturation : CGFloat = CGFloat(arc4random() % 128) / 256 + 0.5 // from 0.5 to 1.0 to stay away from white
let brightness : CGFloat = CGFloat(arc4random() % 128) / 256 + 0.5 // from 0.5 to 1.0 to stay away from black
return UIColor(hue: hue, saturation: saturation, brightness: brightness, alpha: 1)
}