Skip to content

Instantly share code, notes, and snippets.

@gonsolo
gonsolo / 0001-Update-to-v1.3.5.patch
Last active September 18, 2024 06:22
Update metals to 1.3.5 for Arch and add nvchecker
From 9fd94d923c1b9531a05fa852beaa44e0d92e4052 Mon Sep 17 00:00:00 2001
From: Gon Solo <[email protected]>
Date: Wed, 18 Sep 2024 08:14:01 +0200
Subject: [PATCH] Update to v1.3.5.
---
.nvchecker.toml | 4 ++++
PKGBUILD | 26 +++++++++++++-------------
version-fix.patch | 2 +-
3 files changed, 18 insertions(+), 14 deletions(-)
@gonsolo
gonsolo / chipyard_arch_nitefury2.txt
Last active April 15, 2024 19:35
Chipyard on Arch with Nitefury II
As of April 2024:
1. Vivado: Do not run installLibs.sh, manually add libs from script, libtinfo.so.5 can be symlinked
2. XDMA:
- For kernel 6.8.x: Use updated driver from https://github.com/gonsolo/dma_ip_drivers.git branch gonsolo.
- "config bar not found": Start kernel with "pci=nomsi", insmod with "poll_mode=1 interrupt_mode=2".
- After that you should have some devices: /dev/xdma*.
@gonsolo
gonsolo / nvidia_530_on_linux_6.3.3.patch
Created May 24, 2023 16:52
Run nvidia driver 530.30.02 on Linux 6.3.3
diff -u -r nvidia-530.30.02/nvidia/nv-mmap.c /home/gonsolo/nvidia-530.30.02/nvidia/nv-mmap.c
--- nvidia-530.30.02/nvidia/nv-mmap.c 2023-02-22 05:37:36.000000000 +0100
+++ /home/gonsolo/nvidia-530.30.02/nvidia/nv-mmap.c 2023-05-24 18:49:07.797789349 +0200
@@ -458,7 +458,7 @@
}
// Needed for the linux kernel for mapping compound pages
- vma->vm_flags |= VM_MIXEDMAP;
+ vm_flags_set(vma, VM_MIXEDMAP);
@gonsolo
gonsolo / git_author_stats.sh
Last active March 17, 2023 08:18
Discover insertions and deletions of an author for a specified time with git
# Print lines added by author
git log --stat --since 2023-01-01 --author="Charlie Chaplin" | grep insertions | awk '{sum += $4} END {print sum}'
# Print lines deleted by author
git log --stat --since 2023-01-01 --author="Charlie Chaplin" | grep deletions | rev | awk '{print $2}' | rev | awk '{sum += $1} END {print sum}'
# Net amount
echo $(( $(git log --stat --since 2023-01-01 --author="Charlie Chaplin" | grep insertions | awk '{sum += $4} END {print sum}') - $(git log --stat --since 2023-01-01 --author="Charlie Chaplin" | grep deletions | rev | awk '{print $2}' | rev | awk '{sum += $1} END {print sum}') ))
@gonsolo
gonsolo / mp3_to_opus.bash
Last active May 3, 2022 09:54
Convert mp3 to opus with GNU parallel respecting whitespace
find . -name \*.mp3 | parallel -q ffmpeg -i {} -c:a libopus -b:a 20k {.}.opus
@gonsolo
gonsolo / mixin.cc
Created April 12, 2021 15:58
Mixin in c++
#include <iostream>
using namespace std;
class A {
public:
void a() { cout << "a" << endl; }
};
template<typename T> struct Mixin: T {
@gonsolo
gonsolo / crtp.cc
Created April 12, 2021 15:56
CRTP aka static polymorphism
#include <iostream>
// CRTP aka static polymorphism
using namespace std;
template<typename T> class Base {
public:
void bla() {
auto derived = static_cast<T&>(*this);
@gonsolo
gonsolo / rename.sh
Last active June 28, 2020 07:31
Recursive mass rename in all files in a directory
find -name \*.swift -exec perl -pi -e "s/bla/laber/g" {} \;
@gonsolo
gonsolo / How to write a Ptex quad
Last active December 15, 2019 14:55
How to write a Ptex quad face
Basically a hello world for using the Ptex API for writing quad face.
The second example writes random colors to triangle meshes.
@gonsolo
gonsolo / Worst01.swift
Created May 29, 2019 15:56
The worst of the worst, part I
func a() {
print("a")
}
func b() {
print("b")
}
func c() {
print("c")