Skip to content

Instantly share code, notes, and snippets.

View davidtavarez's full-sized avatar
🎯
Focusing

David davidtavarez

🎯
Focusing
View GitHub Profile
@thiagozs
thiagozs / ubuntu-usb-disable-usb-autosuspend.md
Created July 10, 2024 13:42
Ubuntu disable USB autosuspend

Disabling USB Auto-Suspend on Ubuntu

These days Linux supports a lot of devices. However, occasionally you will find a device that works but only for a while, requiring a reboot to work again. This is often due to the device itself not behaving according to the USB standard, and that's more often than not caused by misbehaving USB suspend.

The proper way of fixing this would be either a workaround in the driver or, God forbid, a fix in the device's firmware. But quite often nobody does anything, so what's left is to do the improper. And the easiest improper fix is to disable USB autosuspend.

For the command line, just add usbcore.autosuspend=-1 to GRUB_CMDLINE_LINUX_DEFAULT:

sudo sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="[a-z ]*/& usbcore.autosuspend=-1/' /etc/default/grub
@mtigas
mtigas / onion-svc-v3-client-auth.sh
Last active March 1, 2025 03:50
experiments with using v3 onions with client auth (as of tor 0.3.5.X)
#!/bin/bash
# needs openssl 1.1+
# needs `basez` https://manpages.debian.org/testing/basez/base32hex.1.en.html
# (but something else that decodes the base64 and re-encodes the raw key bytes
# to base32 is probably fine too)
##### generate a key
openssl genpkey -algorithm x25519 -out /tmp/k1.prv.pem
@wm3ndez
wm3ndez / bt2To3.py
Last active September 8, 2016 03:00
A little script made for replacing bootstrap2 classes with the new boostrap3 classes. There are more classes to add, but at this moment these are the ones I need.
import os
import re
import argparse
app_path = os.path.split(os.path.split(__file__)[0])[0]
PROJECT_ROOT = os.path.abspath(app_path)
regexps = [
(r'class=(["\'] *?)row-fluid(.*?["\']+)', r'class=\1row\2'),
(r'class=(["\'] *?)brand(.*?["\']+)', r'class=\1navbar-brand\2'),