Skip to content

Instantly share code, notes, and snippets.

Avatar

gasolin gasolin

View GitHub Profile
View bash_profile.sh
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
eval "$(starship init zsh)"
export ANDROID_HOME=/Users/gasolin/Library/Android/sdk
export JAVA_HOME=/usr/local/Cellar/openjdk/15.0.1/bin
export PATH=$JAVA_HOME:$PATH
export PATH=$PATH:$ANDROID_HOME/platform-tools/:$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin
@gasolin
gasolin / git-line-changes.sh
Created Dec 22, 2020
git line changes in certain period
View git-line-changes.sh
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
View gist:9300f5f9276b2df884c80da3e2c54ffc

Install Android SDK on macOS

Install homebrew https://brew.sh/

brew cask install adoptopenjdk8
brew cask install android-sdk
@gasolin
gasolin / pr.sh
Created Apr 14, 2020
script to fetch the PR and switched to the right branch
View pr.sh
#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
gasolin / PersonalCanvas.md
Last active Jan 29, 2020
Personal Canvas 個人商業畫布
View PersonalCanvas.md
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
View iife.js
// Take con­trol of your globals
//basic
(function () {
// your code here
})();
// pass param in
(function ($) {
$(document).ready(function () {
@gasolin
gasolin / waitForTxToBeMined.js
Created Apr 10, 2018
script to Wait till got the transaction result
View waitForTxToBeMined.js
// https://medium.com/metamask/calling-a-smart-contract-with-a-button-d278b1e76705
async function waitForTxToBeMined (txHash) {
let txReceipt
while (!txReceipt) {
try {
txReceipt = await eth.getTransactionReceipt(txHash)
View newton_sqrt.go
package main
import (
"fmt"
)
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"])