Skip to content

Instantly share code, notes, and snippets.

@xiuno
xiuno / layernorm.rs
Created April 9, 2024 07:13 — forked from ZhangHanDong/layernorm.rs
Code shared from the Rust Playground
use std::fs::File;
use std::io::prelude::*;
use std::mem;
fn layernorm_forward(output: &mut [f32], mean: &mut [f32], rstd: &mut [f32],
input: &[f32], weight: &[f32], bias: &[f32],
batch_size: usize, time_steps: usize, channels: usize) {
let epsilon = 1e-5;
for b in 0..batch_size {
for t in 0..time_steps {
@xiuno
xiuno / rust-cross-compile-openssl
Created February 23, 2023 08:48 — forked from marirs/rust-cross-compile-openssl
Rust OpenSSL Cross Compile for Linux on Mac M1
# Install the toolchain
```bash
brew tap SergioBenitez/osxct
brew install x86_64-unknown-linux-gnu
```
# this should get installed in:
# /opt/homebrew/Cellar/x86_64-unknown-linux-gnu/
# Installing the macOS OpenSSL - if not already installed
package main
import (
"log"
"github.com/piotrnar/gocoin/blockdb"
"github.com/piotrnar/gocoin/btc"
"encoding/hex"
)
func main() {
// Set real Bitcoin network
@xiuno
xiuno / decode_bitcoin_block_data.go
Created December 17, 2018 07:25 — forked from ysqi/decode_bitcoin_block_data.go
Decode bitcoin block chain dat file, and get block data deail content
package main
import (
"bytes"
"crypto/sha256"
"encoding/binary"
"encoding/hex"
"fmt"
"io"
"log"