Skip to content

Instantly share code, notes, and snippets.

View juntao's full-sized avatar

Michael Yuan juntao

View GitHub Profile
@juntao
juntao / cuda.md
Last active October 17, 2023 09:19 — forked from dm4/cuda.md
Run WasmEdge WASI-NN plugin on AWS EC2 Instance

Setup CUDA on AWS EC2 Instance

This tutorial is based on this AWS tutorial. In this tutorial, we will install Nvidia driver on AWS EC2 instance and compile and run llama.cpp on it.

Create an AWS EC2 instance

Here we use g5.4xlarge instance with Ubuntu 22.04 AMI, which use Nvidia A10G GPU.

Install Nvidia driver

let labels = include_str!("aiy_food_V1_labelmap.txt");
let mut i = 0;
let mut max_index: i32 = -1;
let mut max_value: u8 = 0;
while i < res_vec.len() {
let cur = res_vec[i];
if cur > max_value {
max_value = cur;
max_index = i as i32;
// Load the model data from a file
let model_data: &[u8] = include_bytes!("lite-model_aiy_vision_classifier_food_V1_1.tflite");
// Read the input image data from Tencent Cloud's API gateway
let mut buffer = String::new();
io::stdin().read_to_string(&mut buffer).expect("Error reading from STDIN");
let obj: FaasInput = serde_json::from_str(&buffer).unwrap();
let img_buf = base64::decode_config(&(obj.body), base64::STANDARD).unwrap();
// Resize the image to the size needed by the Tensorflow model
@juntao
juntao / main.yml
Created March 23, 2020 15:01
The .github/workflows/main.yml file for Arenztopia.com
name: github pages
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1 # v2 does not have submodules option now
Add the following to "dapp -- Resources"
* JavaScript: https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js
* CSS: https://cdn.bootcss.com/twitter-bootstrap/3.3.7/css/bootstrap.min.css
<p>2020鼠年的春节,我们都不得不待在家里。从开始一句句给我女儿徐笑笑讲述“病毒”“肺炎”,让她理解不能带她去广州玩儿了,到一点点渗透“可能有很长一段时间都不能出门,不能上幼儿园了”……</p>
<p>我想肯定有很多家长,像我一样,努力地向小朋友们解释着发生着的一切;也肯定有很多家长,不知道怎么向小朋友们科学、系统、有效的解释为什么突然就不能出门了。</p>
<p>感谢我身边的朋友们,一起制作了这个18页的中英双语绘本。家长们可以用这个生动形象的绘本,向小朋友解释:新型冠状病毒的传播途径、为什么会出现新型冠状病毒、出门时必须戴口罩、回家必须7步洗手。</p>
@juntao
juntao / # SIG 2019
Last active December 14, 2019 01:24
# SIG 2019
Add the following to "dapp -- Resources"
* JavaScript: https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js
* CSS: https://cdn.bootcss.com/twitter-bootstrap/3.3.7/css/bootstrap.min.css
The "dapp -- CSS" should be empty
https://opendapps.secondstate.io/SIG2019_1576286389667.html
<p>欢迎参加2019海纳亚洲大会!请各位嘉宾在下方输入名字领取 Addison-Wesley 新出版的 <a href="https://www.amazon.com/Building-Blockchain-Apps-Michael-Yuan/dp/0135172322/">Buidling Blockchain App</a> 一书</p><p><center><img width="320px" src="https://blog.secondstate.io/images/20191002-book-etc-01.png"></center></p>
@juntao
juntao / # 普华
Last active November 26, 2019 07:37
Add the following to "dapp -- Resources"
* JavaScript: https://code.jquery.com/jquery-3.4.1.min.js
* CSS: https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css
The "dapp -- CSS" should be empty
https://opendapps.secondstate.io/2019_1574356829918.html
<p>欢迎参加2019普华科技大会!</p><p><center><img width="320px" src="https://www.secondstate.io/demo/2019-puhua.jpg"></center></p><p>请各位嘉宾在下方输入名字签到</p>
Add the following to "dapp -- Resources"
* JavaScript: https://code.jquery.com/jquery-3.4.1.min.js
* CSS: https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css
The "dapp -- CSS" should be empty
Add the following to "dapp -- Resources"
* JavaScript: https://code.jquery.com/jquery-3.4.1.min.js
* CSS: https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css
The "dapp -- CSS" should be empty
pragma lity ^1.2.4;
contract Human {
address public owner;
modifier onlyOwner() {
assert(msg.sender == owner);
_;
}