Skip to content

Instantly share code, notes, and snippets.

@Nexarian
Nexarian / setup_routing_nat.py
Last active February 14, 2025 01:39
IP Routing Prototype in Python
#!/usr/bin/env python3
import os
import socket
import subprocess
import sys
from typing import Any, Dict, Final, List, Tuple
import iptc
import psutil
@Nexarian
Nexarian / ip_routing_ns.sh
Created January 4, 2025 06:13
IP Routing with Namespaces
#!/usr/bin/env bash
set -ex
BRIDGE_NAME="br0"
BRIDGE_IP="192.168.92.1"
setup_bridge() {
echo "Setting up bridge $BRIDGE_NAME"
ip link add name $BRIDGE_NAME type bridge
@Nexarian
Nexarian / ip_routing.sh
Created January 4, 2025 06:13
IP Routing Prototype with direct IP addresses
#!/bin/bash
set -ex
# Function to check if a command succeeded
check_command() {
if [ $? -ne 0 ]; then
echo "Error: $1"
exit 1
fi
@Nexarian
Nexarian / xrdp-setup-x264-no-hw-accel.sh
Last active January 17, 2025 21:38
XRDP setup enabling X264 with no Nvidia or Intel acceleration
#!/usr/bin/env bash
set -e
sudo -v
sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get autoremove -y
~/restart_xrdp.sh
sudo make clean all -j $(nproc)
sudo make install -j $(nproc)
sudo systemctl daemon-reload
sudo service xrdp restart
#!/usr/bin/env bash
function kill_all() {
process=$1
for i in $(ps aux | grep $process | tr -s ' ' | cut -d" " -f 2)
do
sudo kill -9 $i
done
}
@Nexarian
Nexarian / xrdp-setup-no-hw-accel.sh
Last active June 20, 2024 05:45
XRDP setup with only CPU encoding. No hardware acceleration
#!/usr/bin/env bash
set -e
sudo -v
sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get autoremove -y
@Nexarian
Nexarian / setup-freerdp.sh
Last active June 20, 2024 05:45
Install FreeRDP
#!/usr/bin/env bash
set -e
sudo -v
sudo apt install -y make git g++ nasm
git clone https://github.com/cisco/openh264.git ~/openh264
cd ~/openh264
@Nexarian
Nexarian / ubuntu-2204-laptop-setup.sh
Last active June 20, 2024 05:45
Ubuntu 22.04 setup
#!/usr/bin/env bash
set -e
cd ~
sudo -v
sudo apt-get -y install nvidia-prime vim git mesa-utils net-tools \
gnupg2 software-properties-common apt-transport-https gpg wget \
@Nexarian
Nexarian / xrdp-intel-setup.sh
Last active March 17, 2025 15:43
Setup for Intel acceleration and XRDP
#!/usr/bin/env bash
set -e
sudo -v
sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get autoremove -y