Skip to content

Instantly share code, notes, and snippets.

View toonsevrin's full-sized avatar

Toon Sevrin toonsevrin

View GitHub Profile
docker manifest inspect nginx:latest
{
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
"manifests": [
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 1362,
"digest": "sha256:a5a1e8e5148de5ebc9697b64e4edb2296b5aac1f05def82efdc00ccb7b457171",
"platform": {
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-forwarder-conf
data:
nginx.conf: |
events {
worker_connections 512;
}
stream {
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-forwarder-conf
data:
nginx.conf: |
events {
worker_connections 512;
}
apiVersion: v1
kind: ConfigMap
metadata:
name: envoy-proxy
namespace: default
data:
envoy.yaml: >
static_resources:
listeners:
- address:
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
metadata:
namespace: istio-system
name: istiocontrolplane
annotations:
argocd.argoproj.io/sync-wave: "-2"
spec:
profile: minimal
components:
@toonsevrin
toonsevrin / datefixer.py
Created May 4, 2020 13:13
Rewrites the openapi spec to use "time" instead of "date-time" for fields ending in 'date'
import yaml
input = "./swagger/specification.yaml" # Which file to read
output = "./swagger/specification.yaml" # which file to write to
def Fix(obj: object, isDate: bool) -> object:
if type(obj) != dict:
return obj
for k, v in obj.items():
//Instead of having users write the entrypoint like this:
apply(code: u64, action: u64): void {
//notice how the action matching has to be done manually
if (action == fromString("create")) {
this.on_create(Create.from_ds(this.get_ds()));//this.get_ds is a wrapper for read_action_data, an environment function that passes the serialized parameters of the contract call (as a bytestream).
}
}
class Create implements ISerializable {
constructor(user : u64, game : u64, num_rows : u32, num_cols : u32, seed : u32) {
Getting started:
1. Follow this tutorial: https://github.com/AssemblyScript/assemblyscript/wiki/Hello-World to get your environment setup
2. Change the scripts section of your package.json to the one provided in this gist (the only real difference is the --use abort= tag).
3. Use the module.ts provided in this gist for your module source (in the assembly directory).
4. "npm run build" will create your binaries (perhaps you have to mkdir build first though).
5. Uploading to eos requires an abi file, using one of another contract is completely fine though, as our contract does not use any action data.
=> After uploading the abi together with build/untouched.wasm you can push an action to your contract and Hello, World! will be printed.
import "allocator/tlsf";
import { HEADER_SIZE } from "internal/arraybuffer";
const QUESTION_MARK: u8 = 63;
/**
* Entrypoint for the eos contract
*
*/
export function apply(account: u64, action: u64, code: u64): void {