Skip to content

Instantly share code, notes, and snippets.

View Emyrk's full-sized avatar

Steven Masley Emyrk

View GitHub Profile
@Emyrk
Emyrk / index.js
Last active September 20, 2022 19:17
Express SSE Example
'use strict';
const express = require('express');
const fs = require('fs');
const ws = require('ws');
run().catch(err => console.log(err));
async function run() {
const app = express();
@Emyrk
Emyrk / main.go
Last active September 20, 2022 13:57
Basic sse server in golang
package main
import (
"bytes"
"encoding/json"
"fmt"
"math/rand"
"net/http"
"time"
)
@Emyrk
Emyrk / docker-compose.yaml
Last active April 11, 2022 13:39
C4D with External Postgres
version: "3.5"
services:
coder:
image: docker.io/codercom/coder:1.29.1
container_name: coderd
restart: unless-stopped
# network_mode: host
ports:
- 7080:7080/tcp
networks:
type delayedDB struct {
q queryer
delay time.Duration
}
func NewDelayDB(d time.Duration, q queryer) queryer {
return delayedDB{
q: q,
delay: d,
}
@Emyrk
Emyrk / oprv4.txt
Last active January 16, 2020 20:22
OPR V4 Update
The new release has a few hardforks:
- OPR version goes to v4. Includes additional assets
https://github.com/pegnet/pegnet/blob/larger_limit/modules/opr/assets.go#L76-L89
- Ecdsa signatures for Pegnet transactions
Use branch `rcd-e` on `FactomProject/` + factom-walletd, factom, and factom-cli
- PEG Limit per block increases by 500 per block where pUSD is under $0.99, down by 500 when above $0.99
Use branch `larger_limit` on pegnetd and pegnet
@Emyrk
Emyrk / exchange.go
Last active September 10, 2019 20:53
Pegnet Conversion Math
import (
"fmt"
"math/big"
)
// OraclePriceRecordAssetList is used such that the marshaling of the assets
// is in the same order, and we still can use map access in the code
// Key: Asset
// Value: Exchange rate to USD * 1e8
type OraclePriceRecordAssetList map[string]uint64
@Emyrk
Emyrk / examplelogs.go
Last active June 25, 2017 17:52
How we generate logs
package main
import (
"fmt"
log "github.com/sirupsen/logrus"
)
func main() {
fmt.Println("============= Human Readable =============")
@Emyrk
Emyrk / main.go
Last active April 30, 2017 03:00
Read all addresses from v1 wallet
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"strings"

Keybase proof

I hereby claim:

  • I am Emyrk on github.
  • I am stevenmasley (https://keybase.io/stevenmasley) on keybase.
  • I have a public key whose fingerprint is 93E2 6241 7FD0 01E9 BA4D 549B C0EC 97A0 821D 5946

To claim this, I am signing this object: