Skip to content

Instantly share code, notes, and snippets.

View denji's full-sized avatar
🇺🇦

Denis Denisov denji

🇺🇦
View GitHub Profile
@denji
denji / NUMA node problem.md
Created May 7, 2024 01:25 — forked from zrruziev/NUMA node problem.md
Fixing "successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero" problem

What is NUMA (Non-Uniformed Memory Access)

Non-Uniform Memory Access (NUMA) is one of the computer memory design methods used in multiprocessor systems, and the time to access the memory varies depending on the relative position between the memory and the processor. In the NUMA architecture, when a processor accesses its local memory, it is faster than when it accesses the remote memory. Remote memory refers to memory that is connected to another processor, and local memory refers to memory that is connected to its own processor. In other words, it is a technology to increase memory access efficiency while using multiple processors on one motherboard. When a specific processor runs out of memory, it monopolizes the bus by itself, so other processors have to play. , and designate 'access only here', and call it a NUMA node.

1. Check Nodes

lspci | grep -i nvidia
  
01:00.0 VGA compatible controller: NVIDIA Corporation TU106 [GeForce RTX 2060 12GB] (rev a1)
@denji
denji / bash_strict_mode.md
Created April 14, 2024 17:44 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation
@denji
denji / git-cheatsheet.md
Last active December 1, 2023 00:50 — forked from jeremypage/git-cheatsheet.md
Git cheatsheet

Git cheatsheet

Find all instances of text in all commits

git grep "text to look for" $(git rev-list --all)

List commit messages since given commit

@denji
denji / readme.md
Created June 4, 2023 20:35 — forked from ShannonScott/readme.md
[Moving efficiently in the CLI] Key-combination reference for movement in the shell. #tags: mac, linux, bash
@denji
denji / Video Screen Capture with GStreamer.md
Created June 4, 2023 20:34 — forked from ShannonScott/Video Screen Capture with GStreamer.md
[Video Screen Capture with GStreamer] Capture a Linux desktop window video with gsteramer. #tags: gstreamer, linux, xwindows, video

Capture a video of a given X Window with gstreamer.

X Window ID

Get the target window ID with the following:

xwininfo
@denji
denji / nvenc-install.sh
Last active January 30, 2024 19:39 — forked from lucaspar/nvenc-install.sh
Installation script of CUDA-accelerated `ffmpeg` with NVIDIA Encoder ( docker NVIDIA Encoder https://github.com/markus-perl/ffmpeg-build-script )
#!/bin/bash
# =========================================================================
# Source: https://gist.github.com/lucaspar/27f5e108b80524b315be10b2a9049817
# =========================================================================
# This script will compile and install a static FFmpeg build with
# support for NVENC in Ubuntu. Developed in Ubuntu 23.10,
# with NVIDIA Drivers v535.129.03 and CUDA v12.2 with a GPU
# with CUDA capability 8.6 (RTX 3080) (see ccap below).
# It assumes NVIDA drivers are installed and that you have a
# CUDA-compatible GPU. You can check installed drivers with:
@denji
denji / disable-fb.sh
Created May 14, 2023 16:08 — forked from null-dev/disable-fb.sh
Disable efifb at runtime
#!/usr/bin/env bash
# 1. Download and install the QEMU hook helper from here: https://github.com/PassthroughPOST/VFIO-Tools
# 2. Place this file in /etc/libvirt/hooks/qemu.d/NAME OF YOUR VM/prepare/begin/disable-fb.sh
# 3. Make disable-fb.sh executable.
VM_NAME="$1"
echo "libvirt-qemu disable-fb: Disabling efi-framebuffer to prepare to pass GPU to VM $VM_NAME" > /dev/kmsg 2>&1
echo "efi-framebuffer.0" > /sys/bus/platform/devices/efi-framebuffer.0/driver/unbind
@denji
denji / ffmpeg-hevc-encode-nvenc.md
Created May 9, 2023 18:57 — forked from jbboehr/ffmpeg-hevc-encode-nvenc.md
This gist shows you how to encode specifically to HEVC with ffmpeg's NVENC on supported hardware, with a two-pass profile and optional CUVID-based hardware-accelerated decoding.

Encoding high-quality HEVC content in a two-pass manner with FFmpeg - based NVENC encoder on supported hardware:

If you've built ffmpeg as instructed here on Linux and the ffmpeg binary is in your path, you can do fast HEVC encodes as shown below, using NVIDIA's NPP's libraries to vastly speed up the process.

Now, to do a simple NVENC encode in 1080p, (that will even work for Maxwell Gen 2 (GM200x) series), start with:

ffmpeg  -i <inputfile> -pass 1 \
-filter:v hwupload_cuda,scale_npp=w=1920:h=1080:format=nv12:interp_algo=lanczos,hwdownload,format=nv12 \

-c:v hevc_nvenc -profile main -preset slow -rc vbr_2pass \

@denji
denji / nvidia-x-server-settings.txt
Created March 13, 2023 05:16 — forked from DavidMetcalfe/nvidia-x-server-settings.txt
Documents the PowerMizer CLI for potential cron jobs, etc.
Because PowerMizer settings in NVIDIA X Server Settings doesn't persist across sessions,
attempts to overclock can become a nuisance.
The following documents the three CLI settings to modify the Preferred Mode as desired:
# Auto:
nvidia-settings -a [gpu:0]/GPUPowerMizerMode=2
# Adaptive:
nvidia-settings -a [gpu:0]/GPUPowerMizerMode=0
@denji
denji / TypeClipboard.md
Created March 13, 2023 04:04 — forked from ethack/TypeClipboard.md
Scripts that simulate typing the clipboard contents. Useful when pasting is not allowed.

It "types" the contents of the clipboard.

Why can't you just paste the contents you ask? Sometimes pasting just doesn't work.

  • One example is in system password fields on OSX.
  • Sometimes you're working in a VM and the clipboard isn't shared.
  • Other times you're working via Remote Desktop and again, the clipboard doesn't work in password boxes such as the system login prompts.
  • Connected via RDP and clipboard sharing is disabled and so is mounting of local drives. If the system doesn't have internet access there's no easy way to get things like payloads or Powershell scripts onto it... until now.

Windows

The Windows version is written in AutoHotKey and easily compiles to an executable. It's a single line script that maps Ctrl-Shift-V to type the clipboard.