Skip to content

Instantly share code, notes, and snippets.

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 / ubuntu tweaks surface book 2
Last active January 20, 2020 20:08
Tweaks for Ubuntu 18.04 in Surface Book 2
Eliminate hiss:
run:
amixer -c 0 sset 'Auto-Mute Mode' Disabled && sudo alsactl store
create /etc/modprobe.d/sound.conf with the following content:
options snd-hda-intel model=generic
Hibernate
@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