Skip to content

Instantly share code, notes, and snippets.

View hjazz's full-sized avatar
🏠
Working from home

jazz-triple hjazz

🏠
Working from home
View GitHub Profile
find . -type f -exec wc -l {} + | sort -n
@hjazz
hjazz / URLRequest+crul.swift
Last active October 10, 2016 08:54
Request log with curl (swift3)
extension URLRequest {
var curlDescription: String {
get {
var displayString = "curl -v -X \(self.httpMethod!)"
if let absoluteUrl = self.url?.absoluteString {
displayString += " '\(absoluteUrl)'"
}
if let allHTTPHeaderFields = self.allHTTPHeaderFields {
let allHeadersKeys = Array(allHTTPHeaderFields.keys)
let sortedHeadersKeys = allHeadersKeys.sorted()
openssl pkcs12 -clcerts -nokeys -out cert.pem -in cert.p12
openssl pkcs12 -nocerts -out key.pem -in key.p12
openssl rsa -in key.pem -out key.unencrypted.pem
cat cert.pem key.unencrypted.pem > apns.pem
@hjazz
hjazz / gist:8b22668ebc26e5184767
Created January 4, 2016 03:22 — forked from wanybae/gist:4334130
Mac OS X의 터미널에서 Sublime Text 2를 실행하기

Mac OS X 터미널에서 Sublime Text 2 실행하기

Sublime Text 2는 subl(왜 sublime이 아닌지는 의문)이라는 CLI(Command-lime interface)을 갖고있다. 이 유틸리티는 디폴트로 설치되는 다음과 같은 폴더에 위치한다.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

설치

물론 저 폴더에 있는 subl을 바로 사용하면 되겠지만 편리하게 사용할 수 있는 두가지 방법을 적어본다.

@hjazz
hjazz / gist:cc592f61cd06acf1a3b3
Created December 28, 2014 02:33
git log configuration
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
@hjazz
hjazz / gist:11168088
Created April 22, 2014 07:08
밴드, 카톡, 라인으로 글 보내기
// line
@"line://msg/text/%@"
// band
@"bandapp://create/post/?text=%@
// kakao story
@"storylink://posting?post=%@& // 글내용
appid=%@& // KAKAO_APP_KEY
appver=%@& // 앱버전
@hjazz
hjazz / gist:11140626
Created April 21, 2014 11:55
NSArray to va_list
NSArray *locArgs = // from alert "loc-args"
NSRange range = NSMakeRange(0, [locArgs count]);
NSMutableData* data = [NSMutableData dataWithLength: sizeof(id) * [locArgs count]];
[locArgs getObjects: (__unsafe_unretained id *)data.mutableBytes range:range];
NSString *message = [[NSString alloc] initWithFormat:NSLocalizedString(locKey, nil) arguments:data.mutableBytes];
@hjazz
hjazz / URLPercentEscape
Created April 15, 2014 08:24
URLPercentEscape
NSString * encodedString = (NSString *)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(NULL,
(CFStringRef)queryString,
NULL,
(CFStringRef)@"!*'();:@&=+$,/?%#[]",
kCFStringEncodingUTF8 ));
@hjazz
hjazz / sha256.m
Created March 9, 2014 07:51
sha256 string
#import <CommonCrypto/CommonDigest.h>
+ (NSString*)sha256HashFor:(NSString*)input
{
const char* str = [input UTF8String];
unsigned char result[CC_SHA256_DIGEST_LENGTH];
CC_SHA256(str, (unsigned int)strlen(str), result);
NSMutableString *ret = [NSMutableString stringWithCapacity:CC_SHA256_DIGEST_LENGTH*2];
for(int i = 0; i<CC_SHA256_DIGEST_LENGTH; i++)
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)