Skip to content

Instantly share code, notes, and snippets.

View gasolin's full-sized avatar

gasolin gasolin

View GitHub Profile

Keybase proof

I hereby claim:

  • I am gasolin on github.
  • I am gasolin (https://keybase.io/gasolin) on keybase.
  • I have a public key ASBTATfZTrXRVTlv-83OVIthsaIFF-MexOyRrwa_pMWanwo

To claim this, I am signing this object:

@gasolin
gasolin / git-line-changes.sh
Created December 22, 2020 01:03
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
@gasolin
gasolin / bash_profile.sh
Last active October 13, 2021 06:18
bash_profile
# MACOS
source /usr/local/opt/nvm/nvm.sh
nvm use 14
eval "$(starship init zsh)"
export JAVA_HOME=/usr/local/Cellar/openjdk/17
export PATH=$JAVA_HOME/bin:$PATH
# https://reactnative.dev/docs/environment-setup
@gasolin
gasolin / pr.sh
Created April 14, 2020 11:31
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
gasolin / PersonalCanvas.md
Last active January 29, 2020 02:47
Personal Canvas 個人商業畫布
@gasolin
gasolin / gist:9300f5f9276b2df884c80da3e2c54ffc
Last active July 15, 2023 10:13
Install Android Simulator

Install Android SDK on macOS

Install homebrew https://brew.sh/

brew cask install adoptopenjdk8
brew cask install android-sdk
@gasolin
gasolin / close_order.js
Created June 6, 2019 04:00
close positions
'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
gasolin / waitForTxToBeMined.js
Created April 10, 2018 08:47
script to Wait till got the transaction result
// 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)
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
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"])