Skip to content

Instantly share code, notes, and snippets.

@duketwo
duketwo / tmux.md
Created April 17, 2017 05:07 — forked from Bekbolatov/tmux.md
Clean tmux cheat-sheet

Clean tmux cheat-sheet

By resources

sessions

list-sessions        ls         -- List sessions managed by server
new-session          new        -- Create a new session
@duketwo
duketwo / close_steam.sh
Last active May 20, 2017 17:04
Steam link automatically close big picture mode - Linux / Gnome
#!/bin/bash
# wmctrl is required! for debian based distributions: apt-get install wmctrl
# copy to /bin/close_steam.sh
# chmod +x /bin/close_steam.sh
# autostart: launch "gnome-session-properties" and add "close_steam.sh &"
while true
do
wmctrl -c steam
@duketwo
duketwo / danted_install_script.sh
Created November 22, 2017 03:30
Dante-Server (danted) install script (Debian 8 - Jessie)
# Dante-Server install script (Debian 8 - Jessie)
# Start with 'chmod +x danted_install_script.sh && danted_install_script.sh'
# duketwo - 12.11.2017
random_pw=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
network_adapter=$(ip route | grep default | sed -e "s/^.*dev.//" -e "s/.proto.*//")
username="SallySample"
port="31337"
public_ip=$(dig +short myip.opendns.com @resolver1.opendns.com)
echo "Random password: $random_pw"
echo "deb-src http://ftp.de.debian.org/debian/ sid main non-free contrib" >> /etc/apt/sources.list
@duketwo
duketwo / gist:6bd21a90d9527b5fe9e923d7fd24d244
Created August 5, 2020 12:14
Hide docker iptable rules
iptables -L FORWARD -v | grep -v "docker" | grep -v "br-"
@duketwo
duketwo / gist:63cd9fdae6dcc93e49b2a707e5d1233b
Created August 5, 2020 15:48
Git git ignore removed included files
#Add/change gitignore
#Delete all
git rm -r --cached .
#Add all
git add .
#commit
@duketwo
duketwo / gist:e3ef1518b1a6f84c525ee126029543c9
Created March 27, 2021 18:41
Ip route secondary gateway rule
echo 200 fritz >> /etc/iproute2/rt_tables
ip route add default via 192.168.10.1 table fritz
ip rule add from 192.168.10.133 table fritz
ip rule add from 192.168.1.210 table fritz
find / -type f -a \( -perm -u+s -o -perm -g+s \) -exec ls -l {} \; 2> /dev/null
ls -alh /etc/cron.*
sudo -l
ps -aux
netstat -tulpn
ss -ls
find / -type f -writable 2>&1 | grep -v 'Permission denied'
dpkg -l | grep X
python3 -m http.server
find / -user root -perm -4000 -exec ls -ldb {}
# run with "python2 piwik.py http://1.2.3.4/"
import base64
import requests
import sys
class php_ize:
def translate(self, variable):
msg = ""
if type(variable).__name__ == 'int':
@duketwo
duketwo / gist:f445de3a7d23b93e06efdbde3b91f437
Created November 21, 2022 08:49
OpenWRT 4G LTE WAN connection failover handling python Wireguard VPN
import ifaddr
import ipaddress
import logging
import threading
import time
import platform
import subprocess
# 1x Wireguard service running on 100.100.100.100
# One DSL-Line and one LTE/4G-Line and want automatically swap between both while keeping current connections ACTIVE
#include <iostream>
#include <Windows.h>
#include <winternl.h>
#define OUT
// define MessageBoxA prototype
using PrototypeMessageBox = int (WINAPI*)(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType);
// remember memory address of the original MessageBoxA routine
PrototypeMessageBox originalMsgBox = MessageBoxA;