Skip to content

Instantly share code, notes, and snippets.

@hadess
hadess / tmp.c
Created October 5, 2013 23:19
Hack to control the keyboard backlight level on a Thinkpad Lenovo X1 Carbon Touch
/* gcc -o tmp `pkg-config --libs --cflags glib-2.0` tmp.c
*
* # modprobe ec_sys
*
* # watch -n 0.1 hexdump -C /sys/kernel/debug/ec/ec0/io
*
* 00000000 a7 05 a0 e2 00 86 05 00 00 00 47 00 00 03 00 10 |..........G.....|
* 00000000 a7 05 a0 e2 00 86 05 00 00 00 47 00 00 43 00 10 |..........G..C..|
* 00000000 a7 05 a0 e2 00 86 05 00 00 00 47 00 00 83 00 10 |..........G.....|
@hadess
hadess / systemd-services.spec
Created January 20, 2012 16:42
RPM spec file for systemd-services
Name: systemd-services
Url: http://www.freedesktop.org/wiki/Software/systemd
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Version: 38
Release: 1%{?dist}
License: GPLv2+
Group: System Environment/Base
Summary: A System and Service Manager
BuildRequires: libudev-devel >= 160
BuildRequires: libcap-devel
@hadess
hadess / 0001-mmc-sdhci-Disable-run-time-PM.patch
Last active January 7, 2023 18:30
Baytrail-T Wi-Fi stability patch
From df5bb0eca11e6ab072908b6e0d2e7d9e01d1eb84 Mon Sep 17 00:00:00 2001
From: Dong Aisheng <b29396@freescale.com>
Date: Wed, 24 Jun 2015 21:28:48 +0200
Subject: [PATCH] mmc: sdhci: get runtime pm when sdio irq is enabled
SDIO cards may need clock to send the card interrupt to host.
Thus, we get runtime pm when sdio irq is enabled to prevent the clock
resource is released and put it when sdio irq is disabled.
Signed-off-by: Dong Aisheng <b29396@freescale.com>
@hadess
hadess / results.md
Last active June 2, 2021 09:09
Desktop SSD upgrade benchmarking

Using commands from https://askubuntu.com/a/991311

Both running on a Lenovo m720s SFF, through the m.2 PCIe 3.0 x4 interface.

Crucial P1 1TB 3D NAND

Sequential READ speed with big blocks:

` READ: bw=1919MiB/s (2012MB/s), 1919MiB/s-1919MiB/s (2012MB/s-2012MB/s), io=10.0GiB (10.7GB), run=5336-5336msec

@hadess
hadess / check-news.sh
Last active September 6, 2019 12:42
check-news on release for meson
#!/bin/sh
# Copyright (C) 2019 Red Hat, Inc.
# Author: Bastien Nocera <hadess@hadess.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
@hadess
hadess / git-web-show.lua
Last active September 5, 2019 14:06
Launch gitweb/cgit view of repo in browser
Moved to https://gitlab.freedesktop.org/hadess/git-web-show
@hadess
hadess / smf1to0.sh
Last active June 24, 2019 21:29
SMF (Standard Midi File) 1 format to SMF 0 format converter using ALSA's arecordmidi
#!/bin/sh
#
# Adapted from https://music.stackexchange.com/questions/39040/how-can-i-convert-a-standard-midi-file-from-type-1-to-type-0
if [ $# != 2 ] ; then
echo "Usage: $0 infile.mid outfile.mid"
exit 1
fi
arecordmidi -p 14:0 "$2" &
@hadess
hadess / webkit-test.py
Created February 18, 2019 11:55
Simple WebKit test
#!/usr/bin/python3
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('WebKit2', '4.0')
from gi.repository import Gtk, WebKit2
window = Gtk.Window()
def on_destroy(window):
Gtk.main_quit()
@hadess
hadess / Warn-when-a-source-takes-too-long-to-process.patch
Created February 8, 2018 14:13
Warn when a GLib source takes too long to process
From 3ad096f33e6d148127d0417dd0e136dde51f309b Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Sat, 22 Mar 2014 13:18:04 +0100
Subject: [PATCH] XXX Warn when a source takes too long to process
---
glib/gmain.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/glib/gmain.c b/glib/gmain.c
@hadess
hadess / 49-teensy.rules
Created December 15, 2016 15:33
Teensy DFU rules for Fedora
# UDEV Rules for Teensy boards, http://www.pjrc.com/teensy/
#
# The latest version of this file may be found at:
# http://www.pjrc.com/teensy/49-teensy.rules
#
# This file must be placed at:
#
# /etc/udev/rules.d/49-teensy.rules (preferred location)
# or
# /lib/udev/rules.d/49-teensy.rules (req'd on some broken systems)