Skip to content

Instantly share code, notes, and snippets.

@warmonkey
warmonkey / remove_amd_adrenalin.reg
Created November 2, 2024 01:34
Remove "AMD Software: Adrenalin Edition" from Windows Explorer context menu
Windows Registry Editor Version 5.00
[-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shellex\ContextMenuHandlers\ACE]
@warmonkey
warmonkey / factorio_update.sh
Last active November 8, 2024 11:44
Factorio server auto update script and systemd service file.
#!/bin/bash
# if the script hangs on wget download, replace `wget` with `wget -4`
: '
/etc/systemd/system/factorio.service
[Unit]
Descritpion=Factorio Headless Server
After=network.target
@warmonkey
warmonkey / attitude_3d.py
Created September 11, 2023 07:11
3d attitude display with pyqt5
import sys
import math
import numpy as np
from stl import mesh # pip install numpy-stl
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
import pyqtgraph as pg
from pyqtgraph.opengl import GLViewWidget, GLGridItem, MeshData, GLMeshItem
@warmonkey
warmonkey / qt_creator_gdb_crash_on_windows_fix.md
Last active July 16, 2023 07:55
Fix the "Qt Debugger: The GDB process terminated" error on windows

Some MinGW gdb versions will crash on info registers command. [https://sourceware.org/bugzilla/show_bug.cgi?id=26304]

Once a debugger panel in QtCreator opened, it will keep sending info registers command to gdb.
To stop this, remove Debugger.MainWindow/ChangedDocks and Debugger.MainWindow/State fields from C:\Users\[UserName]\AppData\Roaming\QtProject\QtCreator.ini

[Debugger.MainWindow]
AutoHideTitleBars=true
ShowCentralWidget=true
ChangedDocks=[REMOVED THIS]
@warmonkey
warmonkey / base_block.hpp
Last active July 16, 2023 07:47
a simple replacement for gnuradio runtime / block class
#pragma once
#include <vector>
#include <stdexcept>
#define SDR_DICT
#ifdef SDR_DICT
#include <list>
#include <map>
@warmonkey
warmonkey / mysudo.md
Last active May 25, 2023 08:47
mysudo - GUI prompt to start a GUI application as root

Add this line to ~/.bashrc
alias mysudo='pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY'

@warmonkey
warmonkey / open3d_build_win10_python3.11.md
Last active May 6, 2023 08:38
Build Open3D from source on Windows 10 and Python 3.11
@warmonkey
warmonkey / rocm_pytorch_on_amd_integrated_gpu.md
Last active November 2, 2024 03:09
Use ROCm and PyTorch on AMD integrated graphics (iGPU, Ryzen 7 5825u)

UNVERIFIED YET - WAIT FOR UPDATES

pytorch/pytorch#94891 (comment) The pcie atomic issue should be fixed already. Currently i cannot verify.

  1. Install PyTorch with ROCm support
    Following offical installation guide: https://pytorch.org/get-started/locally/#linux-installation
    Choose [Stable] -> [Linux] -> [Pip] -> [Python] -> [ROCm], It should be something like:
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm5.4.2
@warmonkey
warmonkey / XilinxBitHeaderParser.hpp
Last active March 5, 2023 09:50
Xilinx .bit file header parser
class HeaderParser {
private:
uint8_t state;
//0=header len, 1=header data,
//2=key, 3=length, 4=value,
//5=bitstream len, 6=bitstream
uint32_t len;
uint8_t n;
uint8_t key;
@warmonkey
warmonkey / Xilinx_bit_file_explained.txt
Last active March 5, 2023 09:33
Internal structure of Xilinx bitstream (.bit) file
The Xilinx .bit format is pretty simple. It uses keys and lengths to
divide the file.
Parser source code: https://gist.github.com/warmonkey/49dd574fda39f88b5eed5edc92707cf2
Here is an example. Below is a hex dump from the beginning of a .bit file:
00000000: 00 09 0f f0 0f f0 0f f0 0f f0 00 00 01 61 00 0a .............a..
00000010: 78 66 6f 72 6d 2e 6e 63 64 00 62 00 0c 76 31 30 xform.ncd.b..v10
00000020: 30 30 65 66 67 38 36 30 00 63 00 0b 32 30 30 31 00efg860.c..2001