Skip to content

Instantly share code, notes, and snippets.

View xkr47's full-sized avatar

Jonas Berlin xkr47

View GitHub Profile
@xkr47
xkr47 / xkr-clipboard.pl
Created October 6, 2015 11:45
rxvt-unicode: Enable Ctrl-Insert/Ctrl-Shift-c to copy to CLIPBOARD (as opposed to PRIMARY) selection. Pasting works by Meta-<middle button>
#! perl
# Store this file as /usr/lib/urxvt/perl/xkr-clipboard
#
# To enable, add to ~/.Xresources:
#
# URxvt.perl-ext-common: default,xkr-clipboard
# URxvt.iso14755: false
# URxvt.keysym.Shift-Control-C: perl:clipboard:copy
# URxvt.keysym.Control-Insert: perl:clipboard:copy
@xkr47
xkr47 / git-alias.sh
Last active September 25, 2020 06:32
"git alias" command for adding/removing/editing git aliases conveniently
#!/bin/bash
set -eo pipefail
usage () {
cat <<'EOF'
usage:
git alias [<options>]
git alias [<options>] name
git alias [<options>] name newvalue
@xkr47
xkr47 / README.md
Last active August 3, 2020 22:02
Logitech TrackMan Marble FX scroll wheel patch for the Linux kernel

Logitech TrackMan Marble FX scroll wheel patch for the Linux kernel

NOTE I now have a standalone driver available here which is easier to install: https://github.com/xkr47/marblefx

This patch alters the usbmouse kernel driver to support a "scroll wheel mode" using the fourth button (the red button) when connected through a "ID 04d9:1400 Holtek Semiconductor, Inc. PS/2 keyboard + mouse controller" usb-to-ps2 adapter. No idea how things work with other adapters.

It seems the fourth button generates events, but the state of the button is not represented in any bits (at least by said usb-to-ps2 adapter).

@xkr47
xkr47 / DynamicCertOptions.java
Last active July 28, 2020 16:25
An attempt to support TLS SNI in vertx with dynamic reconfiguration support
import io.vertx.core.Vertx;
import io.vertx.core.net.KeyCertOptions;
import javax.net.ssl.*;
import java.net.Socket;
import java.security.*;
import java.security.cert.X509Certificate;
public class DynamicCertOptions implements KeyCertOptions {
@xkr47
xkr47 / Cargo.toml
Last active June 19, 2020 18:39
Seriously funny rust error message
[package]
name = "x"
version = "0.1.0"
edition = "2018"
[dependencies]
dbus = "0.8.1"
@xkr47
xkr47 / README.md
Last active November 11, 2019 12:20
Simple calculator in https://raku.org/ language, with support for time durations & base 2..36

Example session:

2+3

Result: 5₁₀

5d

Result: 5,00:00:00 = 5.000000 days
         120:00:00 = 120.000000 hours
@xkr47
xkr47 / doodle.css
Last active September 24, 2019 09:36
Fix Doodle to use full screen width and to stop resetting the horizontal scrolling when scrolling "outside" the vote table
.d-pagesContainer {
max-width: unset !important;
}
.d-expandableScrollContainer {
overflow: visible !important;
background: white;
max-width: unset !important;
width: unset !important;
}
#d-participationPage #d-metadataView .d-pollMetadataRow, #d-participationPage #d-metadataView .d-pollHiddenButton.d-silentButton {
@xkr47
xkr47 / sar.conf
Last active September 7, 2019 15:06
Example logstash configuration for streaming/tailing sysstat "sar" command
input {
pipe {
tags => [ "sar", "loadavg" ]
command => "env LANG=C sar -q 5"
}
pipe {
tags => [ "sar", "cpu" ]
command => "env LANG=C sar -u 5"
}
}
@xkr47
xkr47 / flowdock.css
Created September 6, 2019 04:39
Flowdock #css
/* make notifications darker - suitable for dark theme */
.msg-body {
color: #585860;
}
.comment-group-hover .msg-body {
color: #9090a0;
}
/* just restore default theme colour that gets overridden by the above for normal messages */
.msg-body > p, .msg-body ul {
@xkr47
xkr47 / twitter.css
Last active September 6, 2019 04:16
My css tweaks for Twitter - install using e.g. Stylish addon for Firefox (https://addons.mozilla.org/en-US/firefox/addon/stylish/)
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain("twitter.com") {
.stream-item .promoted-tweet {
background: #ff9080;
}
/* you might like / in case you missed */
.stream-item.has-recap, .stream-item.has-recap .stream-item {
background: #ccffdd;