Skip to content

Instantly share code, notes, and snippets.

@salrashid123
salrashid123 / gowasm.go
Created February 18, 2023 12:48
Load and run wasm in go with wasmer
package main
/*
$ cat helloworld.ts
export function add(a: i32, b: i32): i32 {
return a + b;
}
$ npm install -g assemblyscript
$ asc helloworld.ts -o hello-world.wasm
@salrashid123
salrashid123 / pydill.py
Created February 18, 2023 12:46
python dill example serialization
#!/usr/bin/python
import dill
# to serialize, uncomment
# class RCE:
# import os
# def __init__(self, v="foo"):
# self._v = v
# def sq(self, n):
# return n*n
@salrashid123
salrashid123 / main.go
Last active July 12, 2023 13:00
Threshold key encryption in golang
package main
import (
"encoding/base64"
"flag"
"fmt"
"io/ioutil"
"os"
"go.dedis.ch/kyber/v4/encrypt/ecies"
@salrashid123
salrashid123 / main.c
Last active February 2, 2023 00:46
TLS-psk with openssl and c
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
@salrashid123
salrashid123 / pgcrypto.md
Created December 19, 2022 11:57
Postgres Encrypted columns using pgcrypto on Google CloudSQL
@salrashid123
salrashid123 / main.py
Last active March 30, 2023 18:55
saving and loading TensorFlow serialized models
# minimal copy of https://www.tensorflow.org/tutorials/keras/text_classification
### which crates a TF Model about movie reviews, then saves the model to a file
#### later on read the model from file and test predictions
import os
import re
import shutil
import string
import tensorflow as tf
from tensorflow.keras import layers
@salrashid123
salrashid123 / main.go
Created December 13, 2022 00:38
Run webassembly with go runtime (https://github.com/wasmerio/wasmer-go)
package main
/*
$ cat helloworld.ts
export function add(a: i32, b: i32): i32 {
return a + b;
}
@salrashid123
salrashid123 / export.go
Last active July 12, 2023 13:00
Threshold key generation and signing with serialization to file
package main
import (
"encoding/base64"
"flag"
"fmt"
"io/ioutil"
"os"
"go.dedis.ch/kyber/v3/pairing/bn256"
@salrashid123
salrashid123 / synthetic.go
Created December 1, 2022 14:27
Generating synthetic logs for GCP Cloud Logging
package main
/*
$ gcloud compute instances create vm1 --shielded-secure-boot --scopes=cloud-platform --zone=us-central1-a --shielded-vtpm --shielded-integrity-monitoring
NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS
vm1 us-central1-a n1-standard-1 10.128.0.104 35.224.160.133 RUNNING
$ gcloud compute instances describe vm1 --format="value(id)"
@salrashid123
salrashid123 / threshold.go
Last active July 27, 2024 13:24
Threshold Signatures in Golang
package main
import (
"encoding/base64"
"fmt"
"go.dedis.ch/kyber/v3/pairing/bn256"
"go.dedis.ch/kyber/v3/share"
"go.dedis.ch/kyber/v3/sign/bls"
"go.dedis.ch/kyber/v3/sign/tbls"