Skip to content

Instantly share code, notes, and snippets.

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

Jonas Cheng jonascheng

🏠
Working from home
View GitHub Profile
@jonascheng
jonascheng / .travis.yml
Created May 3, 2016 07:37
Travis template for nodejs
language: node_js
node_js:
- '4'
install: npm install
script: npm test
notifications:
email:
recipients:
- [email protected]
on_success: always
@jonascheng
jonascheng / git.cmd.sh
Created May 10, 2016 06:43
Frequent Git commands
# Permanently authenticating with Git repositories
$ git config credential.helper store
$ git push https://github.com/repo.git
Username for 'https://github.com': <USERNAME>
Password for 'https://[email protected]': <PASSWORD>
<?xml version="1.0" encoding="UTF-8"?>
<foxyproxy>
<proxies>
<proxy name="emr-socks-proxy" id="2322596116" notes="" fromSubscription="false" enabled="true" mode="manual" selectedTabIndex="2" lastresort="false" animatedIcons="true" includeInCycle="true" color="#0055E5" proxyDNS="true" noInternalIPs="false" autoconfMode="pac" clearCacheBeforeUse="false" disableCache="false" clearCookiesBeforeUse="false" rejectCookies="false">
<matches>
<match enabled="true" name="*ec2*.amazonaws.com*" pattern="*ec2*.amazonaws.com*" isRegEx="false" isBlackList="false" isMultiLine="false" caseSensitive="false" fromSubscription="false" />
<match enabled="true" name="*ec2*.compute*" pattern="*ec2*.compute*" isRegEx="false" isBlackList="false" isMultiLine="false" caseSensitive="false" fromSubscription="false" />
<match enabled="true" name="*10*.amazonaws.com*" pattern="*10*.amazonaws.com*" isRegEx="false" isBlackList="false" isMultiLine="false" caseSensitive="false" fromSubscript
@jonascheng
jonascheng / parallel_commands.sh
Created July 10, 2016 06:02
Shell script to concurrent executing the other commands
#!/bin/sh
# ex: ./parallel_commands.sh 'echo test' 'echo test'
for cmd in "$@"; do {
echo "Process \"$cmd\" started";
$cmd & pid=$!
PID_LIST+=" $pid";
} done
trap "kill $PID_LIST" SIGINT
@jonascheng
jonascheng / gist:0c18b97378b3e375542538b77c1f2ec9
Created July 18, 2016 16:04
Close a terminal without killing the command running in it
$ sleep 1000
^Z
[1]+ Stopped sleep 1000
$ bg
$ disown
$ exit
#!/bin/bash
AWS_BASE_DIR=~/.aws
CREDENTIALS_DIR=$AWS_BASE_DIR/credentials.csv
function aws-credentials {
name=$1
if [[ -z $name ]]; then
echo "Syntax: aws-credentials <name>"
@jonascheng
jonascheng / p4merge4git.md
Created October 24, 2016 02:55 — forked from tony4d/p4merge4git.md
Setup p4merge as a visual diff and merge tool for git
@jonascheng
jonascheng / gist:9c0ec4f03af4d6a56203d802dfff29c0
Created November 27, 2016 06:50
Install python 3.3.x with pyenv in OSX
CFLAGS="-I$(xcrun --show-sdk-path)/usr/include" pyenv install 3.3.0
@jonascheng
jonascheng / handler.js
Created January 24, 2017 12:25
AWS Lambda blueprint cloudwatch-alarm-to-slack
'use strict';
/**
* Follow these steps to configure the webhook in Slack:
*
* 1. Navigate to https://<your-team-domain>.slack.com/services/new
*
* 2. Search for and select "Incoming WebHooks".
*
* 3. Choose the default channel where messages will be sent and click "Add Incoming WebHooks Integration".
@jonascheng
jonascheng / gist:e6530fa4249e78e5174550f853642987
Created February 5, 2017 01:06
android tool hierarchyviewer is not working
The standalone version of hieararchyviewer is deprecated.
Please use Android Device Monitor (tools/monitor) instead.
08:57:39 E/ViewServerDevice: Unable to debug device: samsung-sm_n9208-05157df5db5a2417
08:57:39 E/hierarchyviewer: Missing forwarded port for 05157df5db5a2417
08:57:39 E/hierarchyviewer: Unable to get the focused window from device 05157df5db5a2417
For anyone working with Android 4.1 or later:
you can get Hierarchy Viewer working by setting the environment variable ANDROID_HVPROTO to ddm.
Mac OSX/Android Studio users, remember to start hierarchy viewer from command line so it will pick up the environment variable.