Skip to content

Instantly share code, notes, and snippets.

View SubFive's full-sized avatar

SubFive SubFive

View GitHub Profile
@SubFive
SubFive / switch_window.py
Created December 13, 2021 22:19
switch_window - alternative version for Gnome on Wayland
#!/usr/bin/python3
import dbus
from pprint import pprint
import json
import sys
import time;
def focus_wnd(proxy, id):
@SubFive
SubFive / b3.json
Last active July 21, 2020 01:36
Lista de empresas listadas na B3
[
{
"fullName": "ADVANCED DIGITAL HEALTH MEDICINA PREVENTIVA S.A.",
"tradingName": "ADVANCED-DH",
"details": {
"cnpj": "10.345.009/0001-98",
"tradingCodes": [
"ADHM3"
],
"mainActivityDescription": "Prestação de Serv. de Medicina Preventiva; Comércio. Distribuição. Importação E Exportação de Kits de Teste Laboratorial; Intermediação de Neg.; Licenciamento de Marcas E Franquias; Etc.",
@SubFive
SubFive / .Xmodmap
Last active July 15, 2020 02:57
trying to be ergonomic with xmodmap
! turns right alt into ctrl
remove control = Control_R
keycode 108 = Control_R NoSymbol Control_R
add control = Control_R
! VIM-like navigation for the entire system
keycode 43 = h H h H Left Left
keycode 44 = j J j J Down Down
keycode 45 = k K k K Up Up
keycode 46 = l L l L Right Right
@SubFive
SubFive / LazyInitializationBeanFactoryPostProcessor.kt
Created July 19, 2019 21:11
Lazy loading for spring integration/component tests
/**
* Enables lazy initialization of beans in tests, which means that
* only the beans you're actually using in a test will be initialized/instantiated for you.
*
* The main advantage of this approach is that it removes the need to configure
* properties for beans that you are not even using.
*/
@TestComponent
class LazyInitializationBeanFactoryPostProcessor : BeanFactoryPostProcessor {
override fun postProcessBeanFactory(beanFactory: ConfigurableListableBeanFactory) {
@SubFive
SubFive / Test.kt
Last active April 23, 2019 21:20
MockK: mockkStatic helper for top level functions
fun mockkStatic(fn: KFunction<Any>) {
fn.javaMethod
?.declaringClass
?.name
?.apply { mockkStatic(this) }
?: throw Exception("Couln't get declaringClass name from function ::${fn.name}")
}
@SubFive
SubFive / .Xmodmap
Last active December 12, 2018 21:08
xmodmap: invert keyboard top-row numbers with symbols, square brackets with curly brackets, and backslash with pipeline
keycode 10 = exclam 1 1 exclam onesuperior exclamdown
keycode 11 = at 2 2 at twosuperior onehalf
keycode 12 = numbersign 3 3 numbersign threesuperior threequarters
keycode 13 = dollar 4 4 dollar sterling onequarter
keycode 14 = percent 5 5 percent cent threeeighths
keycode 15 = diaeresis 6 6 asciicircum notsign notsign
keycode 16 = ampersand 7 7 ampersand braceleft seveneighths
keycode 17 = asterisk 8 8 asterisk bracketleft trademark
keycode 18 = parenleft 9 9 parenleft bracketright plusminus
keycode 19 = parenright 0 0 parenright braceright degree
@SubFive
SubFive / switch_window.sh
Last active December 7, 2018 19:03
bash: focus window (with support for cycling through multiple windows of the same program)
#!/bin/bash
# copied without shame with a little adaptation from https://stackoverflow.com/a/33607859
active_win_id=`xprop -root | grep '^_NET_ACTIVE_W' | awk -F'# 0x' '{print $2}' | awk -F', ' '{print $1}'`
if [ "$active_win_id" == "0" ]; then
active_win_id=""
fi
app_name=$1