Skip to content

Instantly share code, notes, and snippets.


gasolin gasolin

View GitHub Profile
gasolin /
Created Dec 22, 2020
git line changes in certain period
git log --shortstat --since "2020-9-1" --until "2020-12-1" | grep "files changed" | awk '{files+=$1; inserted+=$4; deleted+=$6} END {print "files changed", files, "lines inserted:", inserted, "lines deleted:", deleted}'
# files changed 2143 lines inserted: 32933 lines deleted: 19808
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/" ] && \. "$NVM_DIR/" # This loads nvm
eval "$(starship init zsh)"
export JAVA_HOME=/usr/local/Cellar/openjdk/15.0.2
export ANDROID_HOME=/Users/gasolin/Library/Android/sdk
export PATH=$PATH:$JAVA_HOME/bin:$ANDROID_HOME/platform-tools/:$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin
gasolin /
Created Apr 14, 2020
script to fetch the PR and switched to the right branch
#Create a bash in your ~/.bash_profile
# Do `source ~/.bash_profile` or reopen the console to make it work.
# Call `pr 1234` (1234 is the pull request number)
# the PR will be fetched and switched to the right branch
pr() {
git fetch upstream pull/$1/head:pr-$1
git checkout pr-$1
gasolin /
Last active Jan 29, 2020
Personal Canvas 個人商業畫布
View gist:9300f5f9276b2df884c80da3e2c54ffc

Install Android SDK on macOS

Install homebrew

brew cask install adoptopenjdk8
brew cask install android-sdk
View close_order.js
'use strict'
* Test steps
* Create a position with dust amount:
* 1. Put $10 in margin wallet
* (in Order form, switch to margin tab)
* 2. Place market order for BTC, amount 0.001. Click buy button
* 3. You will see the position
gasolin / waitForTxToBeMined.js
Created Apr 10, 2018
script to Wait till got the transaction result
View waitForTxToBeMined.js
async function waitForTxToBeMined (txHash) {
let txReceipt
while (!txReceipt) {
try {
txReceipt = await eth.getTransactionReceipt(txHash)
View newton_sqrt.go
package main
import (
func Sqrt(x float64) float64 {
z := float64(1)
for i := 0; i < 100000; i++ {
z = z - (z * z - x) / 2 * z
View onboarding_schema_test.js
var Joi = require('joi-browser');
const VALID_TOURS = ["private", "addons", "customize", "search", "default", "sync", "library", "singlesearch", "performance", "screenshots"];
const baseKeys = {
client_id: Joi.string().required(),
addon_version: Joi.string().required(),
locale: Joi.string().required(),
session_id: Joi.string(),
page: Joi.valid(["about:home", "about:newtab"])

Network Monitor

The Network Monitor(netmonitor) shows you all the network requests Firefox makes (for example, when it loads a page, or due to XMLHttpRequests), how long each request takes, and details of each request.