Skip to content

Instantly share code, notes, and snippets.

View mbartosi's full-sized avatar

Marek Bartosiewicz mbartosi

  • 14:22 (UTC +02:00)
View GitHub Profile
@damico
damico / test-rocm.py
Created April 10, 2023 18:54
Script for testing PyTorch support with AMD GPUs using ROCM
import torch, grp, pwd, os, subprocess
devices = []
try:
print("\n\nChecking ROCM support...")
result = subprocess.run(['rocminfo'], stdout=subprocess.PIPE)
cmd_str = result.stdout.decode('utf-8')
cmd_split = cmd_str.split('Agent ')
for part in cmd_split:
item_single = part[0:1]
item_double = part[0:2]
@SwitHak
SwitHak / 20211210-TLP-WHITE_LOG4J.md
Last active April 18, 2024 11:20
BlueTeam CheatSheet * Log4Shell* | Last updated: 2021-12-20 2238 UTC

Security Advisories / Bulletins / vendors Responses linked to Log4Shell (CVE-2021-44228)

Errors, typos, something to say ?

  • If you want to add a link, comment or send it to me
  • Feel free to report any mistake directly below in the comment or in DM on Twitter @SwitHak

Other great resources

  • Royce Williams list sorted by vendors responses Royce List
  • Very detailed list NCSC-NL
  • The list maintained by U.S. Cybersecurity and Infrastructure Security Agency: CISA List
@corny
corny / dynv6.sh
Last active April 10, 2024 07:42
Update script for dynv6.com to set your IPv4 address and IPv6 prefix
#!/bin/sh -e
hostname=$1
device=$2
file=$HOME/.dynv6.addr6
[ -e $file ] && old=`cat $file`
if [ -z "$hostname" -o -z "$token" ]; then
echo "Usage: token=<your-authentication-token> [netmask=64] $0 your-name.dynv6.net [device]"
exit 1
fi
@Brainiarc7
Brainiarc7 / skylake-tuning-linux.md
Last active March 30, 2024 16:01
This gist will show you how to tune your Intel-based Skylake, Kabylake and beyond Integrated Graphics Core for performance and reliability through GuC and HuC firmware usage on Linux.

Tuning Intel Skylake and beyond for optimal performance and feature level support on Linux:

Note that on Skylake, Kabylake (and the now cancelled "Broxton") SKUs, functionality such as power saving, GPU scheduling and HDMI audio have been moved onto binary-only firmware, and as such, the GuC and the HuC blobs must be loaded at run-time to access this functionality.

Enabling GuC and HuC on Skylake and above requires a few extra parameters be passed to the kernel before boot.

Instructions provided for both Fedora and Ubuntu (including Debian):

Note that the firmware for these GPUs is often packaged by your distributor, and as such, you can confirm the firmware blob's availability by running:

@Jiab77
Jiab77 / bridged-networking-on-wireless-interface-with-kvm.md
Last active January 18, 2024 05:00
Bridged Networking on Wireless Interface with KVM and more...

Bridged Networking on Wireless Interface with KVM and more...

So I needed to upgrade my home "web hosting" server from a Raspberry Pi 3b to something more flexible where I could even simulate a Raspberry Pi 3b given power. The new server hardware is now an Intel NUC i7 16GB / 250Gb SSD NVME. 😁

I order to accomplish this task I had to find a way to bridge the wireless interface which is the faster one on my actual home network setup.

I've also tried to mix the functionnality from another Rapsberry Pi (3b+ this time) who's acting as WLAN to LAN bridge. More details on this setup. But this was finally a bad idea and I was not able to make it work along the virtual network bridge created by libvirt or manually created... (I will explain why later)

The main difficulty was to use the DMZ IP address given by the router and route the traffic to the guest VM's.

Server / Desktop

@AlecsFerra
AlecsFerra / animated_wallpaper.c
Last active November 6, 2023 21:52
POC for simple animated wallpapers in Xorg
#define _POSIX_C_SOURCE 199309L
//#define DEBUG
#include <Imlib2.h>
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
@MihailJP
MihailJP / gpufan.bash
Created November 5, 2013 13:02
Script to control the fan speed automatically (works only for NVIDIA graphic cards)
#!/bin/bash
# Script to control the fan speed automatically
setFanSpeed() {
eval "nvidia-settings -a GPUFanControlState=1 -a [fan:0]/GPUCurrentFanSpeed=$1 > /dev/null"
}
cleanup() {
eval "nvidia-settings -a GPUFanControlState=0"

How I switched from mdadm to btrfs

After reading [this Ars Technica article][1], I decided that I wanted to start using btrfs on my home fileserver. It had been running for a few years with an mdadm raid-10 array, formatted with ext4, holding about 3.4 TB of data. I figured I would take advantage of some of the special capabilities of btrfs to perform the conversion in place. After some research, I formed my basic plan.

  • backup data to external drives
  • remove two of the drives from the mdadm raid-10
  • configure those two drive with a btrfs raid-0 filesystem
  • copy the data from the degraded mdadm raid-10 to the new btrfs raid-0
  • completely deactivate the mdadm raid-10
@martijnvermaat
martijnvermaat / encrypted-root-debian-wheezy.markdown
Created May 18, 2012 16:55
Encrypted root filesystem on Debian Wheezy

Encrypted root filesystem on Debian Wheezy

This documents how to set up an encrypted root filesystem (except for /boot) on Debian Wheezy with automatic mounting using a keyfile on a USB drive.

Basic setup

In the Debian Installer, choose "Guided - use entire disk and set up encrypted LVM". That's it, on boot you will be asked to enter you passphrase using the keyboard. My system does not usually have a keyboard attached, so that's not very convenient (but read on).