Skip to content

Instantly share code, notes, and snippets.

View zed-wong's full-sized avatar
😵‍💫
Tired

Zed Wong zed-wong

😵‍💫
Tired
View GitHub Profile
@zed-wong
zed-wong / ma-monitor.py
Created April 25, 2023 08:07
BTC ma monitor & notifier through Mixin Messenger
import sys
import json
import math
import time
import uuid
import base64
import hashlib
import asyncio
import requests
import datetime
@zed-wong
zed-wong / aragon-mvm-deployment.md
Created April 19, 2023 03:07
Aragon MVM Deployment
$ npx hardhat run scripts/deploy.ts --network mvm
No need to generate any newer typings.
Deploying...
Ens registry deployed at 0x157682fa262E96BFC62a0541466B9Db21ABba94D
Ens resolver deployed for subdomain dao at 0x65997E3FF2649bA9A407d9863B250C3903641dfF
Ens resolver deployed for subdomain plugin at 0x50BD1516c6E7b377003Bf334F34Be371520d4011
Warning: Potentially unsafe deployment of @aragon/osx/core/dao/DAO.sol:DAO

    You are using the `unsafeAllow.constructor` flag.
@zed-wong
zed-wong / UpdateMixinOneLine.sh
Created April 12, 2023 02:27
Update Mixin Messenger with one line (Ubuntu)
alias updateMixin="proxychains curl -L -o mixin_desktop.deb $(curl -s https://api.github.com/repos/MixinNetwork/flutter-app/releases/latest | grep "browser_download_url.*mixin_desktop_linux_amd64.deb" | cut -d : -f 2,3 | tr -d \") && sudo dpkg -i mixin_desktop.deb && rm mixin_desktop.deb"
@zed-wong
zed-wong / utils.ts
Last active December 11, 2022 13:32
Ts utils functions
// $1.23
export const formatUSMoney = (x: string | number) => {
return new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(Number(x))
}
// $123.23M
export const formatCompactUSD = (x: number) => {
return new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD', maximumSignificantDigits: 2, notation: "compact" , compactDisplay: "short" }).format(x)
}
@zed-wong
zed-wong / disable-ubuntu-sensor.md
Created November 22, 2022 08:49
Disable surface ubuntu sensor (disable screen rotation and touchscreen)
@zed-wong
zed-wong / CurveContract.vy
Created October 22, 2022 01:21
curve-contract
# @version 0.2.4
# (c) Curve.Fi, 2020
# Pool for DAI/USDC/USDT
from vyper.interfaces import ERC20
interface CurveToken:
def totalSupply() -> uint256: view
def mint(_to: address, _value: uint256) -> bool: nonpayable
def burnFrom(_to: address, _value: uint256) -> bool: nonpayable
@zed-wong
zed-wong / CurveCryptoSwap.vy
Created October 8, 2022 09:24
CurveCryptoSwap.vy
# @version 0.3.1
# (c) Curve.Fi, 2021
# Pool for USDT/BTC/ETH or similar
interface ERC20: # Custom ERC20 which works for USDT, WETH and WBTC
def transfer(_to: address, _amount: uint256): nonpayable
def transferFrom(_from: address, _to: address, _amount: uint256): nonpayable
def balanceOf(_user: address) -> uint256: view
interface CurveToken:
@zed-wong
zed-wong / get-nfts-from-mvm.js
Last active August 12, 2022 13:03
The procedure of getting NFT(ERC721) information from MVM with ethers.js
import axios from 'axios';
import { ethers } from 'ethers';
//import ERC721ABI from '../assets/erc721.json';
export async function getNFTsFromExplorer(userAddr, provider){
if (!userAddr) throw new Error('UserAddr is required');
if (!provider) throw new Error('Provider is required');
const fetchTokens = await getTokensFromExplorer(userAddr);
const filteredTokens = filterTokens(fetchTokens);
@zed-wong
zed-wong / authorize.js
Last active July 27, 2022 02:15
Mixin SPA OAuth helper
// https://github.com/fox-one/uikit/blob/main/packages/uikit/src/utils/authorize.ts
// https://github.com/fox-one/uikit/blob/main/packages/uikit/src/services/mixin/oauth.js
import ReconnectingWebSocket from "reconnecting-websocket";
import { gzip } from "pako/lib/deflate";
import { ungzip } from "pako/lib/inflate";
import { v4 as uuidv4 } from "uuid";
import sha256 from "crypto-js/sha256"
import EncBase64 from "crypto-js/enc-base64";
@zed-wong
zed-wong / git-remove-from-history.sh
Created June 12, 2022 06:23
Remove file from git history
git filter-branch --index-filter \
'git rm -rf --cached --ignore-unmatch path_to_file' HEAD