Skip to content

Instantly share code, notes, and snippets.

View xmkevinchen's full-sized avatar

Kai Chen xmkevinchen

View GitHub Profile
### Java
export JAVA_HOME=`/usr/libexec/java_home -v 12`
### Setup for Android
export ANDROID_HOME=$HOME/Programmings/Mobile/Android/sdk
PATH=/usr/local/bin:$PATH
PATH=$PATH:$ANDROID_HOME/emulator
PATH=$PATH:$ANDROID_HOME/tools
PATH=$PATH:$ANDROID_HOME/platform-tools
PATH=$PATH:$ANDROID_HOME/ndk-bundle
@xmkevinchen
xmkevinchen / .tmux.conf
Last active October 24, 2019 22:45
Personal customized tmux configuration
# Customize configuration
set -g mouse on
# Use VIM navigation style
set -g mode-keys vi
# Status update interval
set -g status-interval 1
# Enable 24bit true color
@xmkevinchen
xmkevinchen / .vimrc
Last active October 11, 2019 17:00
Vim config
" Specify a directory for plugins
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged')
" Make sure you use single quotes
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'scrooloose/syntastic'
Plug 'scrooloose/nerdcommenter'
@xmkevinchen
xmkevinchen / apns.sh
Last active March 2, 2017 22:25
Use `curl` to send remote notification with Apple Push Notification Service HTTP/2 api
# Generate Public / Private Keys
openssl pkcs12 -in <.p12> -out <private-key.pem> -nocerts -nodes
openssl pkcs12 -in <.p12> -out <public-key.pem> -clcerts -nokeys
# Reinstall curl with nghttp2
brew install / reinstall curl --with-nghttp2
# Replace Mac OS default curl
brew link curl --force
# POST
@xmkevinchen
xmkevinchen / asyncio_executor_process.py
Created October 21, 2016 06:53
Python: Asyncio How to use blocking function
# asyncio_executor_process.py
import asyncio
import concurrent.futures
import logging
import sys
import time
def blocks(n):
log = logging.getLogger('blocks({})'.format(n))
@xmkevinchen
xmkevinchen / ImageIO+ImageSize.swift
Last active September 10, 2016 14:58
iOS: Getting image size without downloading
import ImageIO
func imageSize(with url: NSURL) -> CGSize {
var size: CGSize = .zero
let source = CGImageSourceCreateWithURL(url, nil)!
let options = [kCGImageSourceShouldCache as String: false]
if let properties = CGImageSourceCopyPropertiesAtIndex(source, 0, options as CFDictionary?) {
if let properties = properties as? [String: Any],