Skip to content

Instantly share code, notes, and snippets.

View zlargon's full-sized avatar
:electron:
Focusing

Leon Huang zlargon

:electron:
Focusing
  • Boston, MA
View GitHub Profile
#!/usr/bin/env node
const { Alchemy, Network } = require('alchemy-sdk');
const ethers = require('ethers');
const EthDater = require('ethereum-block-by-date');
const config = {
apiKey: '3zNbANvcjr5yUHtnGKxXGdnX3dUYxL2X',
network: Network.ETH_MAINNET,
};
# https://gist.github.com/spicycode/1229612
# https://tmuxguide.readthedocs.io/en/latest/tmux/tmux.html
# 0 is too far from `
set -g base-index 1
# detach
bind -n C-e detach-client
# create new tab
@zlargon
zlargon / EnvVars.bat
Created December 29, 2019 13:59
Open Windows "EditEnvironmentVariables" Panel
:: https://serverfault.com/a/351154
cmd /c "start rundll32 sysdm.cpl,EditEnvironmentVariables"
# get env var
function get_env() {
VAR=$(grep ${1} .env)
echo ${VAR#*=}
}
InvoiceLineId InvoiceId TrackId UnitPrice Quantity
1 1 2 0.99 1
2 1 4 0.99 1
3 2 6 0.99 1
4 2 8 0.99 1
5 2 10 0.99 1
6 2 12 0.99 1
7 3 16 0.99 1
8 3 20 0.99 1
9 3 24 0.99 1
@zlargon
zlargon / adjust_time.sh
Created October 18, 2019 04:49
Adjust Time on Mac
#!/bin/bash
sudo sntp -sS pool.ntp.org
@zlargon
zlargon / alferd-backup.sh
Last active September 16, 2022 21:04
[alfred] backup customized web search
#!/bin/bash
# create alfred-backup folder
mkdir -p alfred-backup/preferences/features/websearch
# prefs.plist
cp ~/Library/Application\ Support/Alfred/Alfred.alfredpreferences/preferences/features/websearch/prefs.plist \
alfred-backup/preferences/features/websearch
# resources (images)
git config --global user.name "zlargon"
git config --global user.email "zlargon1988@gmail.com"
git config --global color.ui true
git config --global core.editor vim
git config --global core.ignorecase true
git config --global alias.br branch
git config --global alias.co checkout
git config --global alias.cp cherry-pick
git config --global alias.st stash
git config --global alias.sub submodule
@zlargon
zlargon / import_csv.sql
Last active May 12, 2019 16:11
import large CSV data
SET GLOBAL local_infile = true;
SHOW GLOBAL VARIABLES LIKE 'local_infile';
LOAD DATA LOCAL INFILE '<file.csv>'
INTO TABLE '<table_name>'
COLUMNS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
ESCAPED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES; -- ignore the field names
cat INPUT_FILE | sed 's/^/PREFIX/' | sed 's/$/SIFFIX/' > OUTPUT_FILE