Skip to content

Instantly share code, notes, and snippets.

@jerry73204
jerry73204 / tsdl.pest
Created November 11, 2023 12:13
Pest Grammar for Common Trace Format
// lexical elements
token = {
keyword
| identifier
| constant
| string_literal
| punctuator
}
// keywords
@jerry73204
jerry73204 / rb_2022-05-11-22:35:42_128.stderr
Created July 1, 2022 14:21
2022-05 - Reliable Broadcast on Zenoh logs
thread 'async-std/runtime' panicked at 'called `Option::unwrap()` on a `None` value', /home/aeon/.cargo/git/checkouts/zenoh-cc237f2570fab813/9053912/zenoh/src/net/routing/network.rs:442:37
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: PoisonError { .. }', /home/aeon/.cargo/git/checkouts/zenoh-cc237f2570fab813/9053912/zenoh/src/net/routing/face.rs:183:26
thread 'async-std/runtime' panicked at 'called `Result::unwrap()` on an `Err` value: PoisonError { .. }', /home/aeon/.cargo/git/checkouts/zenoh-cc237f2570fab813/9053912/zenoh/src/net/routing/face.rs:168:26
thread 'async-std/runtime' panicked at 'called `Result::unwrap()` on an `Err` value: PoisonError { .. }', /home/aeon/.cargo/git/checkouts/zenoh-cc237f2570fab813/9053912/zenoh/src/net/routing/face.rs:168:26
thread 'async-std/runtime' panicked at 'called `Result::unwrap()` on an `Err` value: PoisonError { .. }', /home/aeon/.cargo/git/checkouts/zenoh-cc237f25
use futures::future::FutureExt as _;
use futures::stream::StreamExt as _;
use futures::stream;
use futures::join;
use std::task::Poll;
use std::time::Duration;
use std::time::Instant;
async fn pending_futures() {
let (tx, rx) = flume::bounded(4);
@jerry73204
jerry73204 / config.h
Created January 13, 2022 01:42
ETU Hadoop 2015 competition code using lock-free concurrent trie
#ifndef __CONFIG_H__
#define __CONFIG_H__
#define MAX_PATH_LEN 4096
#define MAX_PRODUCT_ID_LEN 256
#define MAX_NUM_PRODUCTS 65536
#define MAX_NUM_TRIE_NODES 1048576
#define MAX_MEM_SIZE 1656885703
#define MIN_READ_SIZE 8192
#define MAX_WRITE_SIZE 65536
@jerry73204
jerry73204 / zenoh_bench.rs
Created December 27, 2021 08:59
Zenoh performance benchmark example
use anyhow::Error;
use anyhow::Result;
use collected::SumVal;
use futures::future;
use futures::stream::StreamExt as _;
use itertools::iproduct;
use std::sync::Arc;
use std::time::Duration;
use std::time::Instant;
use zenoh as zn;
#!/usr/bin/env bash
if [ $# -ne 1 ] ; then
echo "Usage: $0 DIRECTORY"
fi
cd "$1" &&
find . -type f -name '*.avi' -print0 |
while IFS= read -r -d $'\0' file; do
printf "%s\t" "$file"
@jerry73204
jerry73204 / controller.py
Created October 25, 2021 13:35
The controller template for Lab3
import rclpy
from rclpy.node import Node
from nav_msgs.msg import Odometry
from lgsvl_msgs.msg import VehicleControlData, Detection3DArray
class Driver(Node):
def __init__(self):
super().__init__('Driver')
@jerry73204
jerry73204 / PKGBUILD-darknet-alexeyab-yolov4-pre
Last active October 18, 2020 18:34
PKGBUILD file for darknet-alexeyab
# Maintainer: acxz <akashpatel2008 at yahoo dot com>
pkgname=darknet-alexeyab
pkgver=r1833.bef28445
pkgrel=1
pkgdesc='YOLO: Real Time Object Detection Neural Network Library (AlexeyAB fork)'
arch=('i686' 'x86_64')
url='https://github.com/AlexeyAB/darknet'
license=('YOLO')
depends=()
optdepends=(opencv)
@jerry73204
jerry73204 / tch-serde.rs
Created June 3, 2020 19:09
serde on tch-rs types example
use failure::Fallible;
use serde::{
de::Error as DeserializeError, ser::Error as SerializeError, Deserialize, Deserializer,
Serialize, Serializer,
};
use std::fs;
use tch::{Device, Kind, Tensor};
fn main() -> Fallible<()> {
let json = fs::read_to_string("example.json")?;
use failure::Fallible;
use ndarray::Array;
use std::convert::TryFrom;
use tch::Tensor;
fn main() -> Fallible<()> {
let tensor = Tensor::try_from(Array::from_shape_fn(
(3, 300, 200),
|(channel, _row, _col)| match channel {
0 => 1f32,