Skip to content

Instantly share code, notes, and snippets.

@kepstin
kepstin / upgradeslot.sh
Last active September 29, 2024 13:01
OpenWrt multi-slot boot with UEFI systemd-boot (might work with gummiboot)
#!/bin/sh
set -e
rootimg=$1
kernelbin=$2
if [ -z "$rootimg" ] || [ -z "$kernelbin" ] ; then
printf 'Usage: %s ROOTIMG KERNELBIN\n' "$0"
exit 1
@kepstin
kepstin / configuration.yml
Last active May 13, 2024 17:23
Home Assistant EWMA template sensor
- trigger:
- id: state_changed
platform: state
entity_id: sensor.147334558305449_indoor_temperature
to: null
- id: time_pattern
platform: time_pattern
seconds: "/30"
action:
- variables:
@kepstin
kepstin / gist:584acf83708cb228be66833003695410
Last active January 7, 2020 23:17
nm is broken with lto objects
Using the following example C file:
int foo;
int bar = 0;
And compiling the file normally, with gcc -c -o test.o test.c, the nm output looks like this:
0000000000000000 B bar
0000000000000004 C foo
And with gcc -fno-common -c -o test.o test.c:
use std::ops::{Shr,Neg};
use std::marker::Sized;
trait ShrCeil<Rhs=Self>
{
type Output;
fn shr_ceil(self, rhs: Rhs) -> Self::Output;
}
@kepstin
kepstin / dmesg
Created March 22, 2019 04:37
mai dmesg linux kernel 5.0.0
[ 0.000000] Linux version 5.0.0-gentoo (root@mai) (gcc version 8.3.0 (Gentoo 8.3.0 p1.0)) #1 Fri Mar 8 16:06:09 EST 2019
[ 0.000000] x86/fpu: x87 FPU will use FSAVE
[ 0.000000] BIOS-provided physical RAM map:
[ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[ 0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000000e0000-0x00000000000fffff] reserved
[ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000003ffeffff] usable
[ 0.000000] BIOS-e820: [mem 0x000000003fff0000-0x000000003fff7fff] ACPI data
[ 0.000000] BIOS-e820: [mem 0x000000003fff8000-0x000000003fffffff] ACPI NVS
[ 0.000000] BIOS-e820: [mem 0x00000000fffe0000-0x00000000ffffffff] reserved
<?xml version="1.0"?>
<ThermalConfiguration>
<Platform>
<Name>Thinkpad T440p</Name>
<UUID>*</UUID>
<ProductName>*</ProductName>
<Preference>QUIET</Preference><!-- if set to PERFORMANCE, the rapl throttling won't be used -->
<CoolingDevices>
<CoolingDevice>
<Type>rapl_controller</Type>
Authentication-Results: mx.google.com; dkim=neutral (body hash did not
verify) [email protected]; spf=pass (google.com: best guess record for
domain of [email protected]
designates 185.38.172.64 as permitted sender)
smtp.mailfrom=exherbo-dev-bounces+exherbo-dev=kepstin.ca@lists.exherbo.org;
dmarc=fail (p=REJECT dis=NONE) header.from=kepstin.ca

Keybase proof

I hereby claim:

  • I am kepstin on github.
  • I am kepstin (https://keybase.io/kepstin) on keybase.
  • I have a public key ASD0l-qXvzkZ09Y172zL3um2MS5T2qZGMHWB-wp17IhJ4Ao

To claim this, I am signing this object:

#!/bin/bash
hostname="$(hostname -f)"
redis-cli info | tr -d '\015' | while IFS=: read key value
do
case "$key" in
'#'*|'') ;;
*)
echo "$hostname" "redis.$key" "$value"
;;
esac
#!/bin/sh
# Calvin's simple traffic shaper script
# Currently set up to handle traffic shaping on mb gateway
# Note that the ingress and egress rates are hardcoded in the commands below.
set -e
IFACE=$1
if [ -z "$IFACE" ]; then
echo "Usage: $0 <iface>"