Skip to content

Instantly share code, notes, and snippets.

Avatar
💽
the big switcharoo

reese diffficult

💽
the big switcharoo
View GitHub Profile
@diffficult
diffficult / watchdog_setup.md
Created May 4, 2022 21:12
Setting up "Watchdog" to keep Raspberry Pi Alive
View watchdog_setup.md

We have deployed a couple of long-running Raspberry Pis equipped with cameras and sensors reporting into our network 24/7. All these are under uptime monitoring for us to keep track of the network availability.

From to time one of our Raspberry Pis freezes in the field either because of a kernel or a hardware issue. In that case there is nothing that can be done with software anymore. You can’t connect to it, can’t ping the Pi – It becomes impossible to send it a restart command in any way to bring it back to normal operation. Debugging into these events you might find indications of such as freeze in the /var/log/kernel.log file, and only manual powering down, and powering up again brought it back to live.

One little known Pi features is a builtin hardware watchdog. This little hardware service will once enabled watch the system activity and automatically power cycle the Raspberry Pi once it gets stuck.

It’s done in few steps directly on a terminal on your Pi:

  1. Enable the hardware watchdog on your Pi a
@diffficult
diffficult / new_python_version_breaks_packages.md
Last active December 13, 2021 15:54
ARCHLINUX: How to rebuild packages when a new version of Python releases and gets added to [core]
View new_python_version_breaks_packages.md

How to identify and rebuild packages when a new version of Python is released

2021-12-12

Python 3.10 is now in [core].

You may need to rebuild any Python packages you've installed from the AUR. To get a list of them, you can run:

pacman -Qoq /usr/lib/python3.9

@diffficult
diffficult / bt_headset_audio_autoswitch.md
Last active April 28, 2023 13:04
LINUX - Switch your main audio output to your headset when bluetooth connects
View bt_headset_audio_autoswitch.md

Auto switch audio output when a new Bluetooth device connects

Depending on the distro or DE/WM you are running and which programs you are using to manage your audio you maybe run into the hassle of having to switch audio outputs each time you connect a bluetooth device (headset/speaker). You can in fact make pulseaudio to autoswitch when connection is established and not do it manually.

To accomplish this you just need to check a condition in the default.pa config file located in /etc/pulse/ directory on your install and add the following line load-module module-switch-on-connect like in the code snippet below:

...

### Automatically load driver modules for Bluetooth hardware
@diffficult
diffficult / reglas.md
Last active August 17, 2020 07:13
Reglas del Clan
View reglas.md

Nuestra Comunidad

La idea detras de este clan desde un inicio siempre fue juntarse con amigos, hacer nuevos amigos y ayudarnos mutuamente para realizar actividades tanto PVE como PVP de cualquier dificultad sin presiones, despues de todo esto es un juego, una actividad recreativa.

REGLAS

- Los miembros del clan deben ser mayores de 18 años.

@diffficult
diffficult / perprogram_gtktheme.md
Created August 2, 2020 23:19
Use different GTK themes for specific programs
View perprogram_gtktheme.md

Use a different GTK2/3 theme for specific programs

Why would you want to specify a different theme for a program?

Most common scenario, you installed a program that looks horrible or unreadable on your current theme or variation of that theme (light, dark). There's a simple workaround for most programs to fix this problem.


GTK 2

@diffficult
diffficult / trimsetup.md
Created August 2, 2020 09:06
Proper TRIM setup on your system
View trimsetup.md

TRIM on your Linux System

⚠️ WARNING ⚠️

DO NOT ENABLE BOTH PERIODIC TRIM AND CONTINOUS TRIM AT THE SAME TIME

ALSO DEBIAN, REDHAT AND OTHERS HIGHLY RECOMMEND TO DITCH CONTINUOS TRIM TO KEEP YOUR SSD HEALTHY AND THERE'S NO GOOD REASON TO HAVE IT RUNNING ON YOUR SYSTEM.


@diffficult
diffficult / AuthyToOtherAuthenticator.md
Created February 15, 2020 05:41 — forked from gboudreau/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy
View AuthyToOtherAuthenticator.md

Generating Authy passwords on other authenticators


There is an increasing count of applications which use Authy for two-factor authentication. However many users who aren't using Authy, have their own authenticator setup up already and do not wish to use two applications for generating passwords.

Since I use 1Password for all of my password storing/generating needs, I was looking for a solution to use Authy passwords on that. I couldn't find any completely working solutions, however I stumbled upon a gist by Brian Hartvigsen. His post had a neat code with it to generate QR codes (beware, through Google) for you to use on your favorite authenticator.

His method is to extract the secret keys using Authy's Google Chrome app via Developer Tools. If this was not possible, I guess people would be reverse engineering the Android app or something like that. But when I tried that code, nothing appeared on the screen. My gues

@diffficult
diffficult / bluetoothdoubledipping.md
Last active May 31, 2023 01:54
Bluetooth Pairing one device on Dual Boot of Windows & Linux - Stop having to Pair Devices
View bluetoothdoubledipping.md

Bluetooth Pairing one device on Dual Boot of Windows & Linux - Stop having to Pair Devices

You may have experienced when dual booting that you need to re-pair your bluetooth devices (ie., Headphones, mouse, keyboard, etc) this usually happens because you have already paired the device with another operating system using the same bluetooth adapter when dual booting (either Linux or Windows).

Some devices cannot handle multiple pairings associated with the same MAC address (ie., bluetooth adapter). As per suggested on the ArchWiki you can fix this by re-pairing the device each time, but there's actually another solution to not do so each time you choose to use your device on a different OS.

How can we accomplish this?

Easy, just pair the device on a OS and copy the bluetooth keys generated to the other OS so our device doesn't notice the difference.

@diffficult
diffficult / pi_mount_usb.md
Last active August 1, 2021 22:38 — forked from etes/pi_mount_usb.md
How to setup mount / auto-mount USB Hard Drive on Raspberry Pi
View pi_mount_usb.md

How to setup mount / auto-mount USB Hard Drive on Raspberry Pi

Follow the simple steps in the order mentioned below to have your USB drive mounted on your Raspberry Pi every time you boot it.

These steps are required especially if your are setting up a Samba share, or a 24x7 torrent downloader, or alike where your Raspberry Pi must have your external storage already mounted and ready for access by the services / daemons.

Step 0. Plug in your USB HDD / Drive to Raspberry Pi If you are using a NTFS formatted drive, install the following

@diffficult
diffficult / x220_update_bios_from_linux.md
Created May 15, 2019 13:01
Updating the BIOS on Lenovo laptops from Linux using a USB flash stick
View x220_update_bios_from_linux.md
  1. Go to support.lenovo.com (or better use a search engine because the Lenovo website is beautiful but technically pretty broken and slow) and search for the BIOS upgrade of your laptop model.

  2. Download the most recent ISO file. Look for “BIOS bootable update CD”.

  3. Convert the ISO image using the geteltorito utility

Example:

geteltorito -o bios.img g2uj18us.iso