Skip to content

Instantly share code, notes, and snippets.

@rigtorp
rigtorp / rdtsc.c
Created December 4, 2018 22:29
Read rdtsc
static inline uint64_t rdtsc() {
uint64_t hi, lo;
asm volatile ("mfence; rdtsc\n" : "=a" (lo), "=d" (hi));
return (hi << 32) | lo;
}
@rigtorp
rigtorp / git-fetch-all.md
Last active June 25, 2019 08:54
Fetch all remotes for all git repositories in directory

Fetch all remotes for all git repositories in directory (recursively)

$ find . -name .git -type d -execdir git --git-dir '{}' fetch --all ';'
@rigtorp
rigtorp / gist:db4241d25b753c952962e554686735dc
Last active August 24, 2020 07:08
PyTorch gx1010 build output
This file has been truncated, but you can view the full file.
-- The CXX compiler identification is GNU 10.2.1
-- The C compiler identification is GNU 10.2.1
-- Check for working CXX compiler: /usr/lib64/ccache/c++
-- Check for working CXX compiler: /usr/lib64/ccache/c++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/lib64/ccache/cc
-- Check for working C compiler: /usr/lib64/ccache/cc - works
@rigtorp
rigtorp / udpcap.cpp
Created December 8, 2021 17:32
Simple tool to record UDP streams
// © 2021 Erik Rigtorp <erik@rigtorp.se>
// SPDX-License-Identifier: MIT
// udpcap: Simple tool to record UDP streams
#include <arpa/inet.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
@rigtorp
rigtorp / rocm.md
Last active September 18, 2023 01:23
How to build rocm 3.6.x beta from source

Install rocm-cmake

git clone https://github.com/RadeonOpenCompute/rocm-cmake.git
mkdir bulid
cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/rocm ..
make
sudo make install
@rigtorp
rigtorp / ltspice.md
Created May 14, 2024 01:47
Install LTspice on Linux

Download ltspice...

Install wine:

dnf install wine

Install LTspice: