Skip to content

Instantly share code, notes, and snippets.

package pocketbase
import (
"errors"
"fmt"
"time"
"github.com/duke-git/lancet/v2/convertor"
"github.com/go-resty/resty/v2"
"golang.org/x/sync/singleflight"
@tech-engine
tech-engine / HttpProxy.go
Created November 9, 2022 19:36 — forked from yowu/HttpProxy.go
A simple HTTP proxy by Golang
package main
import (
"flag"
"io"
"log"
"net"
"net/http"
"strings"
)
@tech-engine
tech-engine / tcp_client.go
Created November 9, 2022 19:35 — forked from abhishekkr/tcp_client.go
simple golang's net example
package main
import (
"fmt"
"io/ioutil"
"net"
"os"
)
const (
@tech-engine
tech-engine / tcp_demo.go
Created November 9, 2022 19:35 — forked from hyper0x/tcp_demo.go
The interaction demo via TCP in Golang.
package main
import (
"bufio"
"bytes"
"fmt"
"io"
"log"
"net"
"os"
@tech-engine
tech-engine / docker-swarm-architecture.md
Created March 21, 2022 09:56 — forked from scyto/docker-swarm-architecture.md
My Docker Swarm Architecture
@tech-engine
tech-engine / app.js
Created August 21, 2021 12:27
Document Porting An Existing Ethereum DApp To Polyjuice - getPolyJuiceAddr
var App = {
getPolyJuiceAddr: async () => {
const addressTranslator = new AddressTranslator()
const polyjuiceAddress = addressTranslator.ethAddressToGodwokenShortAddress(App.account)
$('#poly-address').text(polyjuiceAddress)
}
}
@tech-engine
tech-engine / app.js
Created August 21, 2021 12:24
Document Porting An Existing Ethereum DApp To Polyjuice - loadWeb3
loadWeb3: async () => {
const providerConfig = {
rollupTypeHash: process.env.ROLLUP_TYPE_HASH,
ethAccountLockCodeHash: process.env.ETH_ACCOUNT_LOCK_CODE_HASH,
web3Url: process.env.WEB3_PROVIDER_URL
}
const provider = new PolyjuiceHttpProvider(process.env.WEB3_PROVIDER_URL, providerConfig)
App.web3Provider = provider
web3 = new Web3(provider)
}
@tech-engine
tech-engine / .env
Created August 21, 2021 12:22
Document Porting An Existing Ethereum DApp To Polyjuice
# use the eth wallet where you have your funds deposited. For more info check
DEPLOYER_PRIVATE_KEY=<YOUR_LAYER_2_ETHEREUM_PVT_KEY>
WEB3_PROVIDER_URL=https://godwoken-testnet-web3-rpc.ckbapp.dev
ROLLUP_TYPE_HASH=0x4cc2e6526204ae6a2e8fcf12f7ad472f41a1606d5b9624beebd215d780809f6a
ETH_ACCOUNT_LOCK_CODE_HASH=0xdeec13a7b8e100579541384ccaf4b5223733e4a5483c3aec95ddc4c1d5ea5b22
@tech-engine
tech-engine / webpack.config.js
Created August 21, 2021 12:20
Document Porting An Existing Ethereum DApp To Polyjuice
const path = require('path')
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
const Dotenv = require('dotenv-webpack')
module.exports = {
entry: './src/app.js', // we need to import this to index.html file
output: {
filename: 'app.js',
path: path.resolve(__dirname, 'dist')
},
plugins: [
@tech-engine
tech-engine / .env
Created August 21, 2021 12:17
Document Porting An Existing Ethereum DApp To Polyjuice
DEPLOYER_PRIVATE_KEY=<YOUR_GANACHE_PVT_KEY>
GANACHE_URL=http://localhost:8545
# ingore the below for now
WEB3_PROVIDER_URL=
ROLLUP_TYPE_HASH=
ETH_ACCOUNT_LOCK_CODE_HASH=