Skip to content

Instantly share code, notes, and snippets.

package main
import (
"fmt"
"math/rand"
"strconv"
"time"
)
func main() {
@icexin
icexin / life.go
Created November 4, 2018 15:47
A simple go wasm interpreter
package main
import (
"bytes"
"encoding/binary"
"flag"
"fmt"
"io/ioutil"
"syscall"
"time"
@icexin
icexin / sign.java
Created October 13, 2019 09:19
ecdsa sign and verify between go and java
package com.icexin;
import org.bouncycastle.asn1.ASN1Integer;
import org.bouncycastle.asn1.DERSequenceGenerator;
import org.bouncycastle.asn1.nist.NISTNamedCurves;
import org.bouncycastle.asn1.x9.X9ECParameters;
import org.bouncycastle.crypto.params.ECDomainParameters;
import org.bouncycastle.crypto.params.ECPrivateKeyParameters;
import org.bouncycastle.crypto.signers.ECDSASigner;
import org.bouncycastle.util.encoders.Hex;
@icexin
icexin / httpctx.go
Last active December 31, 2023 11:53
package main
import (
"context"
"fmt"
"net/http"
"net/url"
)
type contextKey int
@icexin
icexin / errgroup.go
Created July 23, 2020 02:31
example of errgroup
package main
import "golang.org/x/sync/errgroup"
func doData1() (string, error)
func doData2() (string, error)
func doData3() (string, error)
func main() {
var data1, data2, data3 string
// 用于演示go里面如何动态向select添加channel
// 同时演示了网络编程框架里面EventLoop大概长啥样
package main
import (
"fmt"
"reflect"
"time"
)