Skip to content

Instantly share code, notes, and snippets.

View sc0Vu's full-sized avatar
🎯
Focusing

Peter Lai sc0Vu

🎯
Focusing
View GitHub Profile
@sc0Vu
sc0Vu / install_go_pi.sh
Last active November 23, 2020 09:26
Install GO go1.13.4 on Raspberry Pi 3/Zero
filename=go1.13.4.linux-armv6l.tar.gz
gohash=9f76e6353c9ae2dcad1731b7239531eb8be2fe171f29f2a9c5040945a930fd41
sudo rm -rf /usr/local/go
wget https://dl.google.com/go/$filename
sudo tar -C /usr/local -xvf $filename
filehash=$(sha256sum $filename | cut -d ' ' -f1)
if [ $filehash != $gohash ]
then
echo "Filehash was not equal"
exit 0
@sc0Vu
sc0Vu / index.js
Created April 8, 2020 04:11
Static web server for javascript
const koa = require('koa')
const app = new koa()
const serve = require('koa-static-server')
const options = {
rootDir: './html',
forbidden :['forbidden'],
gzip: true,
index: 'index.html'
}
const port = (process.env.PORT && isValidPort(process.env.PORT)) ? parseInt(process.env.PORT) : 3005
@sc0Vu
sc0Vu / fib_test.go
Last active October 4, 2020 07:46
go_performance_example
package fib
import (
"testing"
)
func Fib(n int) int {
switch n {
case 0:
return 0
@sc0Vu
sc0Vu / fib_test.go
Created October 2, 2020 23:53
fib test
package fib
import (
"testing"
)
func BenchmarkFib20(b *testing.B) {
for n := 0; n < b.N; n++ {
Fib(20) // run the Fib function b.N times
}
package main
import (
"fmt"
"io"
"log"
"os"
"unicode"
"github.com/pkg/profile"
package main
import (
"bufio"
"fmt"
"io"
"log"
"os"
"unicode"
package main
import (
"math/rand"
"runtime"
"github.com/pkg/profile"
)
const count = 100000
@sc0Vu
sc0Vu / permitabi.json
Last active March 25, 2021 05:53
Add EIP712Domain
[
{
"name": "owner",
"type": "address"
},
{
"name": "spender",
"type": "address"
},
{
import { Wallet, Contract, providers, BigNumber, utils } from 'ethers'
import { readFileSync } from 'fs'
import { _TypedDataEncoder } from "@ethersproject/hash"
async function permitSign(
wallet: Wallet,
token: any,
approve: {
spender: string
value: BigNumber
@sc0Vu
sc0Vu / tokens
Last active April 29, 2021 03:53
Update to array
[
"TUSD",
"LON",
"BOND",
"RAI",
"UMA",
"YFI",
"BAT",
"MANA",
"1INCH",