Skip to content

Instantly share code, notes, and snippets.

View tpmccallum's full-sized avatar

Timothy McCallum tpmccallum

View GitHub Profile
@tpmccallum
tpmccallum / ssr_wasm.md
Last active May 16, 2022 00:05
How to implements server-side rendering (SSR) using WebAssembly (Wasm)

System

First we update the system (Ubuntu 20)

sudo apt-get update
sudo apt install build-essential
sudo apt-get install npm
npm install svg-url-loader --save-dev
sudo apt install mlocate
@tpmccallum
tpmccallum / wasmedge-sel4-installation-message.md
Created October 5, 2021 23:53
wasmedge-sel4 installation message
In file included from /home/wasmedge/sel4_wasmedge/build/include/c++/v1/unordered_map:435,
                 from /home/wasmedge/sel4_wasmedge/projects/wasmedge/include/common/enum_configure.h:19,
                 from /home/wasmedge/sel4_wasmedge/projects/wasmedge/include/common/configure.h:15,
                 from /home/wasmedge/sel4_wasmedge/projects/wasmedge/include/ast/instruction.h:18,
                 from /home/wasmedge/sel4_wasmedge/projects/wasmedge/lib/interpreter/engine/engine.cpp:2:
/home/wasmedge/sel4_wasmedge/build/include/c++/v1/__hash_table:2069:1: warning: always_inline function might not be inlinable [-Wattributes]
 2069 | __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const& __k, _Args&&... __args)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/wasmedge/sel4_wasmedge/build/include/c++/v1/__hash_table:2069:1: warning: always_inline function might not be inlinable [-Wattributes]
@tpmccallum
tpmccallum / rust_ssd.md
Created August 23, 2021 07:03
Rust SSD object detection
use wasm_bindgen::prelude::*;
use ssvm_tensorflow_interface;
use image::{GenericImageView, Pixel, Rgba};
use imageproc::drawing::draw_hollow_rect_mut;
use imageproc::rect::Rect;
use std::str;
use std::time::{Instant};
// This is for labelling
use imageproc::drawing::{draw_text_mut};
@tpmccallum
tpmccallum / rust_nlp.md
Created August 23, 2021 05:02
Rust code for natural language sentiment analysis
pub fn classify(input_string: &str, data: &str) -> String {
    // Create new hash map to store the string and i32 relationship which this model depends on
    // Blank for now
    let mut map_name: HashMap<String, i32> = HashMap::new();
    println!("Input string: {:?}", input_string);
    //println!("Data: {:?}", data);

    // Lower case
    let lower_data: &str = &data.to_lowercase();
@tpmccallum
tpmccallum / identity.txt
Created July 18, 2021 03:36
Identity output from YOLO
[3.1309958, 3.7360609, 7.5596023, 8.140947, 11.550968, 3.5537832, 18.679655, 7.7324038, 21.751251, 5.194124, 6.5198774, 8.279744, 27.507627, 2.439953, 19.922108, 5.84481, 36.302094, 1.0307188, 24.770523, 3.4727588, 44.409332, 0.8103898, 29.029625, 3.0256753, 52.265076, 0.75566465, 32.578007, 2.9998076, 60.238266, 0.79743963, 34.862087, 3.141696, 67.98178, 1.0265529, 33.813103, 3.5064607, 75.84713, 1.3637655, 34.533035, 4.1023707, 83.629814, 1.5067718, 35.268715, 4.3339453, 91.757545, 1.2159925, 35.167805, 4.0414376, 100.03615, 1.1256113, 37.300835, 3.899107, 107.97643, 1.1797931, 42.82248, 3.960934, 116.05241, 1.3186045, 43.411324, 4.047533, 123.79729, 1.4493527, 42.715275, 4.1945515, 132.25601, 1.6295779, 43.578102, 4.2094626, 139.95926, 1.2279351, 42.631516, 3.4845707, 148.04872, 0.7150499, 45.586876, 2.7567537, 155.99947, 0.34816748, 46.056377, 2.4166744, 163.87994, 0.54889137, 45.837532, 2.7241333, 171.54486, 0.83854085, 49.270832, 2.8604567, 179.80199, 0.9128919, 48.625175, 3.0236893, 187.94133, 0.931271
@tpmccallum
tpmccallum / example_data.txt
Created June 17, 2021 22:51
Example data for bulk transfer
data: 0x3b20673e000000000000000000000000987652e1c2b3b953354a43171063499dce16dc8f000000000000000000000000998b5f197b8a0cb058fd37715cb395af16620b4800000000000000000000000005b6738c42bd6df2065b5ed7066c32faf2843ef40000000000000000000000001d0051ab7d92ed7f4bfb209c074f2ccf4d73b3e3000000000000000000000000b7595328ff77cd262738d9daaa7b314a758f421e0000000000000000000000003bffb970f7e6a74edf2b26bd63ba0f6c711c7aa0000000000000000000000000613a21f7005fb13cf754650f2d20e033c972edd2000000000000000000000000377890312dca77316240fe5f04e98240ecb50299000000000000000000000000c4d61363a89c4dbad264ee8a610b9b0b927aaf450000000000000000000000001b9cda76b9341c21340866bbf9203e5e847d514300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
@tpmccallum
tpmccallum / simple_dapp_001.js
Created May 18, 2021 05:58
Javascript for simple_dapp_001
function getBalance() {
var address, wei, balance
address = document.getElementById("account_address_input").value;
console.log(address);
try {
web3.ss.getBalance(address, function(error, wei) {
if (!error) {
document.getElementById("account_address_output_wei").innerHTML = wei + " Wei";
}
});
@tpmccallum
tpmccallum / simple_dapp_001.html
Created May 18, 2021 05:54
The HTML for simple_dapp_001
<!DOCTYPE html>
<html>
<head>
<title>Simple DApp</title>
</head>
<body>
<!-- Account balance -->
<div id="account_balance" class="form-row text-center">
@tpmccallum
tpmccallum / install_compound_gateway.md
Created March 23, 2021 01:38
A list of instructions to install Compound Gateway

Install Terraform

cd ~
sudo apt update
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=$(dpkg --print-architecture)] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
@tpmccallum
tpmccallum / Create_Docker_version_of_FaaS.md
Last active February 4, 2021 07:51
Create docker version of FaaS

Docker

sudo apt update
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
sudo apt update
apt-cache policy docker-ce
sudo apt install -y docker-ce