Skip to content

Instantly share code, notes, and snippets.

View dabing1022's full-sized avatar
👨‍💻
Focusing

ChildhoodAndy dabing1022

👨‍💻
Focusing
View GitHub Profile
import Foundation
import CoreFoundation
public final class CoreNotificationCenter {
public static let darwin = CoreNotificationCenter(CFNotificationCenterGetDarwinNotifyCenter())
public static let local = CoreNotificationCenter(CFNotificationCenterGetLocalCenter())
#if os(macOS)
public static let distributed = CoreNotificationCenter(CFNotificationCenterGetDistributedCenter())
@dabing1022
dabing1022 / joy_division.pde
Last active May 11, 2021 02:02
Joy Division / Unkwown Pleasures
int padding = 100;
void setup() {
size(800, 800);
frameRate(60);
colorMode(HSB, 360, 100, 100, 100);
}
void draw() {
background(0, 0, 10);
@dabing1022
dabing1022 / LICENCE SUBLIME TEXT
Created June 20, 2018 03:17
Sublime Text 3 Serial key build is 3176
## Sublime Text 3 Serial key build is 3176
> * Added these lines into /etc/hosts
127.0.0.1 www.sublimetext.com
127.0.0.1 license.sublimehq.com
> * Used the license key
----- BEGIN LICENSE -----
ACTION = build
AD_HOC_CODE_SIGNING_ALLOWED = NO
ALTERNATE_GROUP = staff
ALTERNATE_MODE = u+w,go-w,a+rX
ALTERNATE_OWNER = grantdavis
ALWAYS_SEARCH_USER_PATHS = NO
ALWAYS_USE_SEPARATE_HEADERMAPS = YES
APPLE_INTERNAL_DEVELOPER_DIR = /AppleInternal/Developer
APPLE_INTERNAL_DIR = /AppleInternal
APPLE_INTERNAL_DOCUMENTATION_DIR = /AppleInternal/Documentation
@dabing1022
dabing1022 / 0.1-export-plist.sh
Created April 27, 2017 01:44 — forked from mxpr/0.1-export-plist.sh
Export Options Plist flag in xcodebuild
# Switch xcrun to leverage Xcode 7
# Note: This won't be needed once Xcode 7 is released
# and becomes the primary Xcode in use.
export DEVELOPER_DIR=/Applications/Xcode-beta.app/Contents/Developer/
# Export Archive
xcrun xcodebuild -exportArchive -exportOptionsPlist exportPlist.plist -archivePath /path/to/app.xcarchive -exportPath /path/to/app.ipa
@dabing1022
dabing1022 / searchAndAddUUIDForXcodePlugin.py
Created December 16, 2016 02:39 — forked from dhcdht/searchAndAddUUIDForXcodePlugin.py
每次升级Xcode都要把插件们挨个升级才能用,很烦,其实它们大部分只需要在plist里边添加一个UUID而已,这个脚本可以帮你一次性升级Xcode plugin,不保证每个都能用
__author__ = 'dhcdht'
import os
import re
plugin_path = os.path.expanduser('~/Library/Application Support/Developer/Shared/Xcode/Plug-ins')
#for Xcode 6.3
#plugin_uuid = '9F75337B-21B4-4ADC-B558-F9CADF7073A7'
#for Xcode 6.3.2
#plugin_uuid = 'E969541F-E6F9-4D25-8158-72DC3545A6C6'
@dabing1022
dabing1022 / Mac OSX 使用OpenSSL生成RSA公匙、私匙(pem)与DER文件.sh
Created August 17, 2016 12:50
Mac OSX 使用OpenSSL生成RSA公匙、私匙(pem)与DER文件
λ ChildhoddAndy [ChildhoodAndy/SampleDemos/OpenSSLTest] → openssl
OpenS
OpenSSL> genrsa -out rsa_private_key.pem 2048
Generating RSA private key, 2048 bit long modulus
..+++
.+++
e is 65537 (0x10001)
OpenSSL> pkcs8 -topk8 -inform PEM -in rsa_private_key.pem -outform PEM –nocrypt
Enter Encryption Password:
Verifying - Enter Encryption Password:
@dabing1022
dabing1022 / Xcode 忽略警告.m
Last active July 21, 2016 07:10
add `__unused`
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
// Start executing the requested task
[targetForExecution performSelector:methodForExecution withObject:objectForExecution];
#pragma clang diagnostic pop
"-Wgnu"
"-Warc-performSelector-leaks"
"-Warc-retain-cycles"
@dabing1022
dabing1022 / gist:7247e6ecea638233a94226524019ed7e
Created May 27, 2016 01:18 — forked from jimbojsb/gist:1630790
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@dabing1022
dabing1022 / NStringCharactersLength.mm
Created September 16, 2015 03:18
获得字符串的字符数
// @"一中华abc" 8
- (int)convertToInt:(NSString*)strtemp
{
int strlength = 0;
char* p = (char*)[strtemp cStringUsingEncoding:NSUnicodeStringEncoding];
for (int i=0 ; i<[strtemp lengthOfBytesUsingEncoding:NSUnicodeStringEncoding] ;i++) {
if (*p) {
p++;
strlength++;
}