Skip to content

Instantly share code, notes, and snippets.

@vuori
vuori / openwrt-23-05-802-11r.md
Created November 19, 2023 20:15
OpenWRT 23.05 802.11r + EAP

Getting 802.11r Fast Transition working with WPA(2)-Enterprise is quite painful. There is information on the forums, but things have changed quite a bit during the last few years. These are notes mostly for my own benefit.

Tricky bits as of OpenWRT 23.05 (in Luci "WLAN roaming" tab of wireless network settings):

  • NAS Id should be set to something unique, like the name of the AP.
  • Mobility domain defaults to a sane value. Leave it empty.
  • Reassociation deadline's default of 1000 is bad. Apparently Cisco uses 20000 here, setting that appears to be helpful.
  • FT Protocol "Over the air" is the good setting.

If you're using WPA2-PSK, check "Generate PMK locally" and you're done. Save&apply and it should just work.

@vuori
vuori / openpgp.md
Created April 2, 2023 09:20
Keyoxide proof

openpgp4fpr:61AEDDFE8756CC98F7A4F262039AB9BA5FC8736D

@vuori
vuori / xterm-selection.sh
Created August 13, 2022 13:59
get/set X selections from zsh
# copy selection: same as xclip, but works from remote hosts too
zclip() {
# See https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands
# for targets. Usually either p(rimary), c(lipboard) or both, or s(elect) to use
# the definition of SELECT from X resources. For the adventurous, q (secondary)
# is also available.
#
# Note: SetSelection must be in allowed window ops.
#
# Flags: -n don't chomp newline, -t pass to stdout ("tee")
@vuori
vuori / FixGoogleLinks.js
Last active August 9, 2021 21:03
A quick hack for TamperMonkey to clean up spying bits from Google search results
@vuori
vuori / likeget.py
Created February 21, 2021 13:07
Get a user's Twitter likes (favorites) in twint JSON format using the official API
#!/usr/bin/env python3
# pylint: disable=invalid-name,line-too-long,broad-except
"""
Returns as many liked tweets from given Twitter user
as the API allows. Output format is compatible with twint
(https://github.com/twintproject/twint) JSON output
(i.e. one JSON object per line, _not_ wrapped into an array).
This uses the official API since likes seem to be inaccessible
without logging in at the moment.
@vuori
vuori / ubuntu-wpa-rekey-workaround.md
Last active August 10, 2020 17:41
Instructions and patch for enabling wpa_supplicant PTK0 rekey issue workaround

My Intel AX201/Ubuntu 20.04 was getting hit hard by the PTK0 rekey issue: traffic would slow down to dialup speeds after the first rekey. Fixing this and having the fix work with NetworkManager requires recompiling wpa_supplicant with a patch. Steps:

  1. Get current Ubuntu/Debian source: apt-get source wpasupplicant
  2. Get latest version: git clone git://w1.fi/hostap.git
  3. Install packaged version config: cp wpa-2.9/debian/config/wpasupplicant/linux hostap/wpa_supplicant/.config
  4. Save below patch to supplicant.patch and apply: patch -p1 < supplicant.patch
  5. Rebuild supplicant: cd hostap/wpa_supplicant && make
  6. Move original binary aside (as root): mv /sbin/wpa_supplicant /sbin/wpa_supplicant.orig
@vuori
vuori / limit_charge.sh
Created August 5, 2020 22:32
Shell script to set battery charge limits on Thinkpads with post-2018 kernels (acpi_call kernel module not needed)
#!/bin/bash
# On post-2018 kernels the Thinkpad charge threshold mechanism has
# been included in the thinkpad-acpi module. Hence the tpacpi-bat
# tool (and the acpi_call kernel module) are no longer necessary;
# you can just set the values in sysfs.
# Stop charging at this percentage
STOP_AT=80
# Start charging at this percentage
@vuori
vuori / getimg.py
Created December 22, 2019 11:30
Download Twitter favorite images
import json
import sys
import os
import re
import urllib.request
import time
import datetime
# Install twint: https://github.com/twintproject/twint
# Grab favorites: twint --username <myuser> --images --favorites --json -o tweets.json
// ==UserScript==
// @name Widen TweetDeck
// @namespace http://github.com/vuori
// @description Make Tweetdeck columns wider
// @grant GM_addStyle
// @homepageURL https://gist.github.com/vuori/16285203aeb8b2cbff038b6b6073ba22
// @updateURL https://gist.githubusercontent.com/vuori/16285203aeb8b2cbff038b6b6073ba22/raw/WidenTweetdeck.js
// @include https://tweetdeck.twitter.com/*
// @run-at document-start
// @version 1.0
@vuori
vuori / FixTweetdeckLinks.js
Last active February 23, 2019 18:39
Userscript to remove t.co shortening from Tweetdeck outgoing links