Skip to content

Instantly share code, notes, and snippets.

@smallzzy
smallzzy / breakout.py
Created August 18, 2021 08:41
breakout port in Azure Sonic when cmd does not work, tested on DX010
#! /usr/bin/env python3
import json
import subprocess
import copy
target = 'Ethernet124'
brk_mode = '4x25G[10G]'
speed = '25000'
def parse_lane(port):
@smallzzy
smallzzy / cast.h
Last active April 19, 2019 22:02
cast unsigned to signed
#ifndef CAST_H
#define CAST_H
// cast number to signed implementation independently
// develop from https://stackoverflow.com/questions/13150449/efficient-unsigned-to-signed-cast-avoiding-implementation-defined-behavior
#include <type_traits>
#include <limits>
template<typename Tu>
@smallzzy
smallzzy / build.sh
Last active March 29, 2019 17:57
halide build
# depends on libjpg-dev libpng-dev
cmake -DLLVM_DIR=<path to llvm\lib\cmake\llvm> \
-DWITH_TESTS=OFF -DWITH_APPS=OFF -DWITH_TUTORIALS=OFF -DWITH_DOCS=OFF \
-DCMAKE_C_COMPILER=clang-8 -DCMAKE_CXX_COMPILER=clang++-8 \
# -DHALIDE_SHARED_LIBRARY=OFF \
-DCMAKE_INSTALL_PREFIX=<install path> ..
@smallzzy
smallzzy / CMakeLists.txt
Last active August 12, 2019 19:05
my compile options
-fsantize=address -fsanitize-address-use-after-scope -fno-omit-frame-pointer
-fsantize=undefined
-Wshadow
https://developers.redhat.com/blog/2018/03/21/compiler-and-linker-flags-gcc/
#
-fexceptions