Skip to content

Instantly share code, notes, and snippets.

@cheater
cheater / user.py.diff
Created July 27, 2012 12:04
saltstack salt #1704
diff --git a/tmp/user.py.orig b/usr/share/pyshared/salt/states/user.py
index ef27816..b6dc24d 100644
--- a/tmp/user.py.orig
+++ b/usr/share/pyshared/salt/states/user.py
@@ -101,6 +101,7 @@ def present(
name,
uid=None,
gid=None,
+ gid_from_name=False,
groups=None,
@cheater
cheater / sleep-countdown
Created November 18, 2018 17:33
sleep with countdown in bash
#!/bin/bash
sleep_time="$(( $1 - 1 ))" # subtract 1, since we wait on the 0th second.
start_s="$(date +%s)"
start_ns="$(date +%N)"
div_whole() {
# whole-number division of integers.
a="$1"
@cheater
cheater / CRT_Yee65.fx
Last active July 18, 2020 06:20
This is my Retro CRT preset for ReShade.
/*
Ripped from Sonic Mania
*/
#include "ReShade.fxh"
@cheater
cheater / firefox.ahk
Created September 1, 2020 23:48
Firefox quick tab switching and search - AutoHotKey script
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Enable warnings to assist with detecting common errors.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
; Only allow one instance of this script to run. If this script is run again,
; replace the old instance with the new one.
#SingleInstance Force
@cheater
cheater / usb-ether.sh
Last active June 24, 2024 21:08 — forked from dafta/usb-ether.sh
Steam Deck USB Ethernet - get internet from other device, eg from MacOS or from Windows Internet Connection Sharing
#!/bin/sh
echo "This script will let the Steam Deck use internet from a device it's connected to via USB. Reconnect USB after using it to start the connection or the interface might not show up. On Windows, you'll have to share internet with the new Ethernet device in the control panel. If things don't work, try disconnecting and reconnecting the network connection on Windows /from which/ you are getting internet (i.e. what connects the Windows computer to your router). Note if you want to do USB tethering on your phone you don't use this, you just use your phone's USB tethering functionality."
if [ "$UID" -ne 0 ]; then echo "This script needs to be executed as root"; exit 1; fi
if ! (lsmod | grep dwc > /dev/null); then echo "Please enable DRD in BIOS. Turn off your Steam Deck, then press volume up and the power button until you hear the beep. Go to Setup Utility, then set it under Advanced > USB Configuration > USB Dual-Role Device"; exit 1; fi
vendor_id="0x3000" # Valve
product_id="0x28DE"
serial_number=
@cheater
cheater / prompt
Last active February 25, 2024 01:10
turn any command into a prompt
#!/bin/bash
# USAGE
#
# If you have to run the same program over and over with the last few arguments
# always changing, you can use this command like this:
#
# prompt myprog --arg1 -arg2 arg3 "this is arg 4"
#
# A prompt will show up which you can exit using Ctrl-D.