Skip to content

Instantly share code, notes, and snippets.

View ilovelili's full-sized avatar
🏠
Working from home

min ju ilovelili

🏠
Working from home
View GitHub Profile
msg := &messaging.Message{
Data: map[string]string{
"type": "mention",
"commentId": "1",
"picture": "https://cdn.woodstock.club/logo.png",
"name": "min",
"comment": "you are cool",
},
Notification: &messaging.Notification{
Title: category,
@ilovelili
ilovelili / chia-farming.sh
Last active May 5, 2021 10:55
chia farming
# first, install
sudo apt-get update
sudo apt-get upgrade -y
git clone https://github.com/Chia-Network/chia-blockchain.git -b latest
cd chia-blockchain
sh install.sh
. ./activate
@ilovelili
ilovelili / auth.go
Last active June 13, 2021 07:52
Z様 OAuth1 integration
package handler
import (
"fmt"
"net/http"
"github.com/labstack/echo"
"github.com/woodstock-tokyo/woodstock-zaim/server/util"
)

Credential creation flows using the MONiD Library

Introduction

At MONiD we model verifiable credentials using W3C Verifiable credential specification, aside from some very recent spec modifications. Below you can see an example of a credential, serialized as JSON-LD, stating that the did did:monid:ffcc8f84fae1b6ad253561d7b78167a661d72f58e86e60dbd04cd9b81096cdbe is associated with the email address [email protected]. You might notice that the subject, issuer, and signer of the credential, are the same identity. This can be effectively referred to as a self signed, or self issued, credential.

{
  "@context": [

Credential creation flows using the MONiD Library

Introduction

At MONiD we model verifiable credentials using W3C Verifiable credential specification, aside from some very recent spec modifications. Below you can see an example of a credential, serialized as JSON-LD, stating that the did did:monid:ffcc8f84fae1b6ad253561d7b78167a661d72f58e86e60dbd04cd9b81096cdbe is associated with the email address [email protected]. You might notice that the subject, issuer, and signer of the credential, are the same identity. This can be effectively referred to as a self signed, or self issued, credential.

{
@ilovelili
ilovelili / ipfs.sh
Last active July 7, 2021 11:38
ipfs init
sudo apt-get install htop -y # This is not necessary, I just have it for check the resources consumption
sudo apt-get update
sudo apt-get install golang-go -y
export PATH=$PATH:$GOROOT/bin:$GOPATH/
export GOPATH=$HOME/go
wget https://dist.ipfs.io/go-ipfs/v0.4.15/go-ipfs_v0.4.15_linux-amd64.tar.gz
tar xvfz go-ipfs_v0.4.15_linux-amd64.tar.gz
sudo mv go-ipfs/ipfs /usr/local/bin/ipfs
ipfs init
ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8080
package wsclient
import (
"fmt"
"github.com/gorilla/websocket"
pubsub "github.com/woodstock-tokyo/simple-pubsub"
"github.com/woodstock-tokyo/woodstock-alpaca/server/util"
)

Hosting IPFS from behind NAT/Firewall using a free reverse proxy (ngrok)

  1. Expose localhost's port 4001 to public internet using ngrok: ngrok tcp 4001. Tip: Use -region= flag for lower latency.
  2. Note the hostname and port returned by ngrok in the form: tcp://hostname:port -> localhost:4001
  3. Open the ipfs config json file ~/.ipfs/config
  4. Edit as follows: Addresses.Announce=["/dns4/put-the-hostname-here/tcp/put-the-port-here"]
  5. Save the config file
  6. ipfs daemon
@ilovelili
ilovelili / api.go
Created October 15, 2022 10:59 — forked from vdparikh/api.go
Wrap GoLang Echo server in Lambda handler for API Gateway
package main
import(
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
"github.com/labstack/echo"
"github.com/labstack/echo/middleware"
)
func main() {
@ilovelili
ilovelili / secrets-manager.go
Created October 24, 2022 07:18
load aws secrets manager
// Use this code snippet in your app.
// If you need more information about configurations or implementing the sample code, visit the AWS docs:
// https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/setting-up.html
import (
"github.com/aws/aws-sdk-go/service/secretsmanager"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/session"
"encoding/base64"