Skip to content

Instantly share code, notes, and snippets.

View iddm's full-sized avatar

Shockingly Good iddm

View GitHub Profile
@iddm
iddm / NVIDIA_Performance_Counters.md
Created December 11, 2023 06:54 — forked from xaliander/NVIDIA_Performance_Counters.md
ERR_NVGPUCTRPERM: Permission issue with Performance Counters

Error

ERR_NVGPUCTRPERM: Permission issue with Performance Counters

Solutions for this issue

NVIDIA has a page that addresses the issue. Unfortunately, the instructions didn't solve the problem for me. However, I found a solution from rameshgunjal in the NVIDIA forums.

Option 1: Running the program as admin

You might have noticed that sudo nv-nsight-cu results in an error. Instead, you have to provide the path: sudo /usr/local/cuda/bin/nv-nsight-cu. The same applies for other applications as well: sudo /usr/local/cuda/bin/nsight-sys.

@iddm
iddm / vkrt_ hit_variables.md
Last active January 26, 2023 19:49
Vulkan Ray Tracing API documentation regarding gl_GeometryIndexID, gl_InstanceID, gl_PrimitiveID in the hit shader

Missing documentation found empirically for the aforementioned variables.

We can traverse only one TLAS at at time. While traversing it via traceRayEXT, we can hit just one BLAS at at a time. Hence, all the *ID references here are relative to the BLAS we hit (except gl_InstanceID):

  1. gl_GeometryIndexID - Geometry index within the BLAS this ray has hit.
  2. gl_InstanceID - BLAS index within the TLAS.
  3. gl_PrimitiveID - Triangle (or other primitive) index within the BLAS.
@iddm
iddm / version.c
Created November 22, 2022 13:56
Print out the C standard being used.
// Credits to "Robk" https://stackoverflow.com/users/13382603/robk
// From https://stackoverflow.com/questions/4991707/how-to-find-my-current-compilers-standard-like-if-it-is-c90-etc
static void _printversion() {
if (!__STDC__ && !__STDC_VERSION__) printf("The C compiler does not comply with the C89 or later standard!\nIt likely complies with the 1978 K&R C standard (informally known as C78).\n");
else if (__STDC_VERSION__ >= 201710L) printf("The C compiler complies with the C17 standard.\n");
else if (__STDC_VERSION__ >= 201112L) printf("The C compiler complies with the C11 standard.\n");
else if (__STDC_VERSION__ >= 199901L) printf("The C compiler complies with the C99 standard.\n");
else if (__STDC_VERSION__ >= 199409L) printf("The C compiler complies with the amended C90 standard (also known as C95).\n");
else if (__STDC__) printf("The C compiler complies with the ANSI C89 / ISO C90 standard.\n");
@iddm
iddm / split_string_by_line.lua
Created September 14, 2021 18:47 — forked from iwanbk/split_string_by_line.lua
Split string by line in Lua
for line in yourString:gmatch("([^\n]*)\n?") do
-- do something
end
# First get your monitor's name from ddc.
❯ ddcutil detect
Display 1
I2C bus: /dev/i2c-4
EDID synopsis:
Mfg id: VSC
Model: XG270
Serial number: VXR194200328
Manufacture year: 2019
EDID version: 1.4
@iddm
iddm / pass-gen.sh
Created February 25, 2020 10:25
Sort of password generator for Linux
openssl rand -base64 32
@iddm
iddm / docker_kill.sh
Created February 24, 2020 18:08 — forked from evanscottgray/docker_kill.sh
kill all docker containers at once...
docker ps | awk {' print $1 '} | tail -n+2 > tmp.txt; for line in $(cat tmp.txt); do docker kill $line; done; rm tmp.txt
@iddm
iddm / ssd-write-bench.sh
Last active March 27, 2022 06:28
Universal Linux SSD Write speed test
#!/bin/sh
# This will read 4GB+ data from /dev/zero and write to a test file in current directory.
# If you need to test the speed of your SSD drive, go to any partition with it with a filesystem
# with write support, make sure you have rights to do this and then run the command below (or just this script).
# As a sort of customisation, the block size ideally should be identical to the block size of your device:
# https://unix.stackexchange.com/questions/52215/determine-the-size-of-a-block-device
# However, the `64k` value worked absolutely fine for my setup.
dd if=/dev/zero of=test_$$ bs=64k count=64k conv=fdatasync && rm -f test_$$
@iddm
iddm / download-and-compile-emacs.sh
Last active July 10, 2019 11:03 — forked from strobe/compile-emacs.sh
Compile emacs 26.2 on CentOS 7.x
export VERSION=26.2
yum install gcc make ncurses-devel giflib-devel libjpeg-devel libtiff-devel gnutls-devel
curl -O http://ftp.gnu.org/gnu/emacs/emacs-$VERSION.tar.xz > emacs.tar.xz
tar xJf emacs.tar.xz
cd emacs-$VERSION
./configure --without-x --without-selinux
make && sudo make install
@iddm
iddm / remove-docker-containers.md
Created February 21, 2018 19:30 — forked from ngpestelos/remove-docker-containers.md
How to remove unused Docker containers and images
  1. Delete all containers

     $ docker ps -q -a | xargs docker rm
    

-q prints only the container IDs -a prints all containers

Notice that it uses xargs to issue a remove container command for each container ID

  1. Delete all untagged images