Skip to content

Instantly share code, notes, and snippets.

View jayv's full-sized avatar

Jo Voordeckers jayv

View GitHub Profile
@jayv
jayv / .wezterm.lua
Last active February 16, 2024 22:37
wezterm byobu keybindings
-- Pull in the wezterm API
local wezterm = require("wezterm")
local act = wezterm.action
-- This table will hold the configuration.
local config = {}
-- In newer versions of wezterm, use the config_builder which will
-- help provide clearer error messages
if wezterm.config_builder then
@jayv
jayv / install-latest-stable-nvim.sh
Created October 13, 2023 20:06
Build and install neovim from stable tag on ubuntu as a .deb pkg
# /bin/bash
# run from inside a neovim clone, eg:
# git clone https://github.com/neovim/neovim.git
set -euo
echo building latest stable neovim
# update all remote data
git fetch origin --tags --force
# switch to latest remote/stable tag
git checkout tags/stable
# build all things
@jayv
jayv / gist:8941338ee06cabdd77f55f98a73b8f93
Last active June 2, 2022 03:37
bluez linux AirPods Pro low volume stuck patch
From: https://unix.stackexchange.com/questions/437468/bluetooth-headset-volume-too-low-only-in-arch/562381#562381
> For those who don't want to compile the whole thing, the hex code of that method (in Ubuntu 20.04) is
> `48 8b 46 70 66 83 78 0a 7f` and if you replace the `7f` with `ff`, that method basically always returns TRUE.
> Just hexedit your /var/lib/bluetooth/bluetoothd and restart bluetooth.
`sudo vi /usr/lib/bluetooth/bluetoothd` (old: `sudo vi /var/lib/bluetooth/bluetoothd`)
-> `:%!xxd`
@jayv
jayv / 70-keyboard.hwdb
Last active June 16, 2022 06:32
Remap Alt and Windows key in Linux at the driver via udev hwdb
$ sudo vi /etc/udev/hwdb.d/70-keyboard.hwdb
# evdev:input:b<bus_id>v<vendor_id>p<product_id>e<version_id>-<modalias>
# use `lsusb` and `sudo udevadm info /dev/input/by-id/usb-*` to get values for bus, vendor, product, revision
# use `sudo evtest` to get scan code for lhs to rhs key mapping from /usr/include/linux/input.h
# Metadot Das Keyboard Pro 4 (MAC)
evdev:input:b0003v24F0*
KEYBOARD_KEY_700e2=leftmeta
KEYBOARD_KEY_700e3=leftalt
@jayv
jayv / jenkins-autofav-clear.groovy
Last active February 15, 2018 01:41
clear jenkins favorites for users of multi-branch
def user = User.get("<your user id>")
user.getProperty(hudson.plugins.favorite.user.FavoriteUserProperty.class).data.clear()
user.save()
// Execute here:
http://lfbuild.corp.adobe.com:8080/script
@jayv
jayv / git-transplant.sh
Last active July 27, 2017 18:37
git rebase transplant
git rebase --onto <target> <common-forkpoint> <feature>
will detach <feature> from <common-forkpoint> and reattach on top of <target>
@jayv
jayv / ExampleSpec.scala
Last active March 4, 2017 20:37
Mocking CDI Events doesn't work out of the box with ScalaMock, extend from the MockEventFactory and create an Event[T] using mockEvent[T]
import MockEventFactory
import javax.enterprise.event.Event
import org.junit.runner.RunWith
import org.scalamock.scalatest.MockFactory
import org.scalatest.junit.JUnitRunner
import org.scalatest.FlatSpec
@RunWith(classOf[JUnitRunner])
class ExampleSpec extends FlatSpec with MockFactory with MockEventFactory {
@jayv
jayv / mute-apple-mail-thread.applescript
Last active February 2, 2019 21:18
AppleScript for use in an Automator Service to bind to a shortcut to mute threads in Mail.app (like gmail mute)
on run {input, parameters}
tell application "System Events"
set activeApp to name of first application process whose frontmost is true
if "Mail" is in activeApp then
tell application "Mail"
-- Collect the rules that already exist
set ruleNames to {}
repeat with ruleNumber from 1 to count rules
import re
import sys
import subprocess
from collections import defaultdict
def move_tail(topic, groups, path="/opt/kafka/bin/", env="staging"):
command = r"%skafka-run-class.sh kafka.tools.GetOffsetShell --broker-list kafka-seed-1.%s.livefyre.com:9092 --topic %s --time -1 "
cli = command % (path, env, topic)
proc = subprocess.Popen(cli, stdout=subprocess.PIPE, shell=True)
(out, err) = proc.communicate()
@jayv
jayv / shl.sh
Created October 30, 2015 18:48
Syntax highlighting code on the clipboard to RTF colored and formatted to paste into Keynote
pbpaste | highlight -O rtf /dev/stdin --font-size 34 --font Menlo --style molokai -W -J 80 -j 3 --src-lang java | pbcopy