Skip to content

Instantly share code, notes, and snippets.

David C kccheung

Block or report user

Report or block kccheung

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kccheung
kccheung / INSTRUCTIONS_MOBX.md
Last active Mar 12, 2017 — forked from darklight721/INSTRUCTIONS.md
Using MobX with decorators in React Native
View INSTRUCTIONS_MOBX.md

Using MobX with decorators in React Native

The following instructions should work with React Native v0.32:

  1. Install mobx libraries.

    npm install mobx --save
    npm install mobx-react --save
@kccheung
kccheung / INSTRUCTIONS_TYPESCRIPT_ENUM.md
Created Mar 12, 2017
An simple instructions on how to use enum in typescript
View INSTRUCTIONS_TYPESCRIPT_ENUM.md

In TypeScript 1.8+, you can create a string literal type to define the type and an object with the same name for the list of values. It mimics a string enum's expected behaviour.

Here's an example:

type MyStringEnum = "member1" | "member2";

const MyStringEnum = {
    Member1: "member1" as MyStringEnum,
    Member2: "member2" as MyStringEnum
};
View replace_node_modules_gradle_versions.sh
#!/usr/bin/env bash
targetVersion="$1"
if [ "$1" == "" ]; then
echo "Usage: $0 <buildToolsVersion>";
else
find \
node_modules \
-type f \
-iname 'build.gradle' \
View gist:74ff6d287ee6a32677b188fda593eac0
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
@kccheung
kccheung / .vimrc
Last active Jul 10, 2017 — forked from simonista/.vimrc
A basic .vimrc file that will serve as a good template on which to build.
View .vimrc
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
" Turn on syntax highlighting
syntax on
@kccheung
kccheung / docker-container-process-monitor.md
Last active Sep 29, 2017
Simple steps detailing how to monitor process within docker container, TL;TR; we will use New Relic's infrastructure service.
View docker-container-process-monitor.md
  1. install new relic on the instance to be monitored: https://docs.newrelic.com/docs/infrastructure/new-relic-infrastructure/installation/install-infrastructure-linux#install-procedure
  2. after step two of echo "license_key: YOUR_LICENSE_KEY" | sudo tee -a /etc/newrelic-infra.yml:
    • vi /etc/newrelic-infra.yml and add the line strip_command_line: false, this allows the command line filter to include all arguments
  3. restart newlic agent by: sudo systemctl restart newrelic-infra
  4. (optional) update agent, please read: https://docs.newrelic.com/docs/infrastructure/new-relic-infrastructure/installation/update-infrastructure-agent
  5. To create an alert on cron process, please goto INFRASTRUCTURE -> Settings -> Alerts -> Create alert condition, check existing created alert for reference
@kccheung
kccheung / pyscript.py
Created Apr 30, 2018 — forked from n8henrie/pyscript.py
Python script template
View pyscript.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""pyscript.py
A simple python script template.
http://ajminich.com/2013/08/01/10-things-i-wish-every-python-script-did/
"""
import argparse
@kccheung
kccheung / fork-helper.py
Created May 11, 2018 — forked from ottosch/fork-helper.py
A script to help using ymgve's bitcoin_fork_claimer script
View fork-helper.py
#!/usr/bin/env python
# This script is meant to be used with bitcoin_fork_claimer: https://github.com/ymgve/bitcoin_fork_claimer
# The outputs of this script are the inputs to that script.
# Python 2.x is required
import urllib2
import json
import sys
View keybase.md

Keybase proof

I hereby claim:

  • I am kccheung on github.
  • I am chubao (https://keybase.io/chubao) on keybase.
  • I have a public key ASCtq2R1gydp_8FoB0Nxec7TW1M__3aeAVd7N2y4dvs2Fwo

To claim this, I am signing this object:

View pybybit.py
import hashlib
import hmac
import json
import time
import urllib.parse
from threading import Thread
from collections import deque
from requests import Request, Session
from requests.exceptions import HTTPError
You can’t perform that action at this time.