Skip to content

Instantly share code, notes, and snippets.

View rodrigopedra's full-sized avatar

Rodrigo rodrigopedra

  • São Carlos, Brazil
View GitHub Profile
@rodrigopedra
rodrigopedra / NVInstall.md
Created October 1, 2025 12:14 — forked from GNY-001F2/NVInstall.md
GUIDE: Installing Nvidia Drivers correctly on OpenSUSE Tumbleweed
## Prerequisite: You must either boot to your OS on runlevel 3, or you must manually disable all
## instances of the X server when running the NVIDIA installer.

# Check if you have the packman repository installed
$ zypper lr
# output will be like this:
#  | Alias                 | Name                  | Enabled | GPG Check | Refresh
---+-----------------------+-----------------------+---------+-----------+--------
 1 | RepoAlias             | RepoName              | Yes/No  | Yes/No    | Yes/No   
@rodrigopedra
rodrigopedra / pam_kwallet-guide.md
Created September 17, 2025 06:28 — forked from benediktg/pam_kwallet-guide.md
Short guide for pam_kwallet with KDE Plasma 5 on openSUSE

(based on these two blog entries and inspired by Fedora-Blog)

First install pam_kwallet:

sudo zypper in pam_kwallet

Then edit the files /etc/pam.d/passwd, /etc/pam.d/login and /etc/pam.d/sddm as follows, i.e. add the lines beginning with a - (the hyphens are valid PAM syntax to reduce log entries if these PAM modules should not exist) and ending with the ### comment:

/etc/pam.d/passwd :

@rodrigopedra
rodrigopedra / virgl3d-ubuntu.md
Created September 11, 2025 01:36 — forked from plembo/virgl3d-ubuntu.md
3d acceleration for Linux guests in KVM on Ubuntu Desktop

VirGL for Linux KVM guests on Ubuntu Desktop

NOTE: Please don't ask for help here, it was a miracle that I got it to work at all. Seek answers in the usual places (yes, even Stackoverflow knows more than I do).

The question: How can I get 3d accelerated graphics for Linux guests in KVM without using PCI passthrough?

The short answer is: Use VirGL. The long answer is more complicated, because the VirGL project has had slow but steady progress towards actually working reliably, but the degree to which any given Linux distribution (or related driver project) is in sync has varied greatly over time. Even if it works right now, today, on your machine, it might not tomorrow. Note that even when it works, graphics performance is mediocre to downright painful.

Tested on Ubuntu Desktop 22.04.04 LTS with qemu-kvm, in an "Ubuntu on Xorg" session (not Wayland). Linux quests must have spice-vdagent installed (Ubuntu installs this by default). The hardware is a AMD 5600G d

PHP is_a() vs is_subclass_of()

<?php

class A {}

class B extends A {}
@rodrigopedra
rodrigopedra / create-swap.sh
Created September 3, 2025 20:43 — forked from Jeckerson/create-swap.sh
Create swap file on Linux
fallocate -l 1G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo "/swapfile none swap sw 0 0" | tee -a /etc/fstab
@rodrigopedra
rodrigopedra / Plasma-X11-improved.md
Created July 21, 2025 22:04 — forked from guiodic/Plasma-X11-improved.md
Improved Plasma X11 experience

This guide is to improve the KDE Plasma experience on X11. It particularly applies to those using the modesetting driver (mainly Intel graphics cards)

Install Xorg-git or Xlibre

This is a crucial step. XLibre and xorg-git contain the "TearFree" feature for modesetting, which is not available in the standard releases. If you use a driver other than modesetting, check that the TearFree option exists for your driver.

Installation depends on the distribution you use. On Arch Linux and derivatives:

Xorg-git:

@rodrigopedra
rodrigopedra / hls.sh
Created April 26, 2025 08:23 — forked from stenuto/hls.sh
HLS ffmpeg script
#!/bin/bash
# Function to display usage information
usage() {
echo "Usage: $0 /path/to/input.mp4 [ /path/to/output_directory ]"
exit 1
}
# Check if at least one argument (input file) is provided
if [ $# -lt 1 ]; then
@rodrigopedra
rodrigopedra / try-catch.ts
Created March 20, 2025 07:09 — forked from t3dotgg/try-catch.ts
Theo's preferred way of handling try/catch in TypeScript
// Types for the result object with discriminated union
type Success<T> = {
data: T;
error: null;
};
type Failure<E> = {
data: null;
error: E;
};
@rodrigopedra
rodrigopedra / XGH - de-de.txt
Created March 7, 2025 06:50 — forked from banaslee/XGH - de-de.txt
eXtreme Go-Horse Process
eXtreme Go Horse (XGH) Process
Quelle: http://gohorseprocess.wordpress.com
Übersetzung ursprünglich von https://gist.github.com/Neffez/f8d907ba8289f14e23f3855011fa4e2f
1. Ich denke, also ist es nicht XGH.
In XGH wird nicht gedacht, es wird das erste gemacht, was in den Sinn kommt. Es gibt auch keine zweite Option, die erste ist schneller.
2. Es gibt 3 Wege ein Problem zu lösen: den richtigen Weg, den falschen Weg und den XGH Weg, welcher exakt wie der falsche ist, aber schneller.
#!/bin/bash
# SPDX-License-Identifier: MIT
## Copyright (C) 2009 Przemyslaw Pawelczyk <[email protected]>
##
## This script is licensed under the terms of the MIT license.
## https://opensource.org/licenses/MIT
#
# Lockable script boilerplate