Skip to content

Instantly share code, notes, and snippets.

@jpeletier
jpeletier / gist:42fa341eeec51bf5256acef2986a3f98
Created March 19, 2025 13:49
thinkfan configuration p14s gen5
Quick thinkfan configuration for Lenovo p14s gen5 intel:
1.- Create /etc/thinkfan.conf with this content:
tp_fan /proc/acpi/ibm/fan
hwmon /sys/devices/virtual/thermal/thermal_zone0/hwmon1/temp1_input
### speed level | start temp | end temp
### NO FAN!!!
@jpeletier
jpeletier / gist:ee591d9b298d21032ef08427bba4f498
Last active March 19, 2025 13:41
ubuntu tweaks - suspend when laptop lid is closed
Suspend when laptop lid is closed, even if there is an external monitor plugged in:
1.- dconf-editor org.gnome.settings-daemon.plugins.power
set lid-close-suspend-with-external-monitor to TRUE
2.- edit /etc/systemd/logind.conf
set as follows:
HandleLidSwitch=suspend
HandleLidSwitchDocked=suspend
LidSwitchIgnoreInhibited=no
@jpeletier
jpeletier / kvm-public-bridge
Last active December 10, 2022 13:34
How to configure public bridge for KVM
Copied from: https://levelup.gitconnected.com/how-to-setup-bridge-networking-with-kvm-on-ubuntu-20-04-9c560b3e3991
Other source: https://ostechnix.com/install-and-configure-kvm-in-ubuntu-20-04-headless-server/
The default networking that KVM provides is a private bridge that uses NAT to allow the guest VMs to talk to the outside world. This works for a lot of use-cases and is probably the best default setup. But sometimes I need the VMs to share the network with the host. In many of my past articles that created VMs, I’ve been able to get away with the default networking. But a future project I’m working on will need VMs operating on the host network, so I wanted to document how to do that here.
There are a lot of articles on setting up a public bridge; it seems like a popular topic. But many of the articles are old and don’t use the latest networking configuration software available with Ubuntu or they manage networking and KVM with a GUI interface. I will be using only command-line tools, as I don’t actua
@jpeletier
jpeletier / experiments_test.go
Created September 4, 2019 10:18
Hasher pooling benchmark
package experiments
import (
"encoding/binary"
"fmt"
"math/rand"
"strconv"
"strings"
"sync"
"testing"
@jpeletier
jpeletier / autobuild-openconnect-7-ubuntu.sh
Created February 25, 2016 16:23 — forked from darrenpmeyer/autobuild-openconnect-7-ubuntu.sh
Autobuild script for OpenConnect 7 (Ubuntu 14/15 trusty/vivid)
#!/usr/bin/env bash
oc_ver="7.06"
echo "Autobuild OpenConnect $oc_ver"
echo " "
echo "This script uses apt-get and make install via sudo rights"
echo "To simplify this, we're going to use sudo -v to pre-authenticate you"
sudo -k
sudo -v