Skip to content

Instantly share code, notes, and snippets.

View darfux's full-sized avatar

darfux darfux

  • Beijing, China
View GitHub Profile
@Nexarian
Nexarian / xrdp-nvidia-setup.sh
Last active February 9, 2026 20:36
Setup for XRDP using Nvidia Acceleration
#!/usr/bin/env bash
set -e
cd ~
sudo -v
# Make sure system is in a good, updated, clean, state.
sudo apt-get -y update
@stephenbradshaw
stephenbradshaw / https_server_python3.py
Last active January 2, 2026 03:51
Python 3 Simple HTTPS server (versions for above and below python3.7 and helper script to generate certificate)
#!/usr/bin/env python
import http.server
import ssl
# Create certifcate and key: https://github.com/stephenbradshaw/pentesting_stuff/blob/master/example_code/create_self_signed_https_certs.py
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
context.load_cert_chain(certfile="https_self_signed_cert.pem", keyfile="https_self_signed_key.pem")
httpd = http.server.HTTPServer(('127.0.0.1', 443), http.server.SimpleHTTPRequestHandler)
@3lpsy
3lpsy / x-resize
Last active September 22, 2025 13:13
Manual Implementation of Auto Resizing For Non-Gnome Environments (like XFCE) running under Spice/Libvirt
#!/bin/bash
# SPDX-License-Identifier: MIT License
# Steps:
# 1) Make sure bash is available
# 2) Create udev rule
# - path to new udev rule: /etc/udev/rules.d/50-x-resize.rules
# - udev rule content:
# ACTION=="change",KERNEL=="card0", SUBSYSTEM=="drm", RUN+="/usr/local/bin/x-resize"
# 3) Create /var/log/autores directory
# 4) Create script /usr/local/bin/x-resize (this file) and make executable
@jelovac
jelovac / README.md
Last active February 20, 2026 22:18
Ubuntu Mate 20.04 XRDP setup

Ubuntu Mate 20.04 XRDP setup

Documenting XRDP setup which worked for me on Ubuntu Mate 20.04.

Some parts are taken from: http://c-nergy.be/blog/?p=14093.

Install xrdp

sudo apt install xrdp
import requests
def format_bytes(size):
# 2**10 = 1024
power = 2 ** 10
n = 0
power_labels = {0: '', 1: 'K', 2: 'M', 3: 'G', 4: 'T'}
while size > power:
size /= power
@smoser
smoser / README.md
Last active March 2, 2026 01:08
qemu to linux mapping of smbios / dmi information

Mappings for DMI/SMBIOS to Linux and dmidecode

Information can be put into dmi tables via some qemu-system hosts (x86_64 and aarch64). That information is exposed in Linux under /sys/class/dmi/id and can be read with dmidecode. The names are very annoyingly inconsistent. The point of this doc is to map them.

See qemu-system-x86_64 --help for the fields that qemu will accept. qemu smbios flags vary with qemu version.

Mappings

Example qemu cmdline:

qemu-system-x86_64 -smbios type=,field=value[,...]

@MatanShahar
MatanShahar / target.xml
Last active November 1, 2024 22:06
GDB qXfer target description for real-mode qemu
<?xml version="1.0"?>
<!-- Copyright (C) 2010-2017 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. -->
<!DOCTYPE target SYSTEM "gdb-target.dtd">
<target>
<architecture>i8086</architecture>
@Informatic
Informatic / domain.xml
Last active March 14, 2026 03:54
How to use Windows 10 OEM license in libvirt VM (<smbios mode='host' /> does not work as Windows seems to verify UUID; apparmor/security configuration changes may be needed)
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
<!-- ... -->
<qemu:commandline>
<qemu:arg value='-acpitable'/>
<qemu:arg value='file=/some/path/slic.bin'/>
<qemu:arg value='-acpitable'/>
<qemu:arg value='file=/some/path/msdm.bin'/>
<qemu:arg value='-smbios'/>
<qemu:arg value='file=/some/path/smbios_type_0.bin'/>
<qemu:arg value='-smbios'/>
@chrisdone
chrisdone / gist:02e165a0004be33734ac2334f215380e
Last active March 18, 2026 11:48
Build and run minimal Linux / Busybox systems in Qemu

Common

export OPT=/opt
export BUILDS=/some/where/mini_linux
mkdir -p $BUILDS

Linux kernel