Skip to content

Instantly share code, notes, and snippets.

View KargJonas's full-sized avatar
👨‍🔬
Still testing ...

Jonas Karg KargJonas

👨‍🔬
Still testing ...
View GitHub Profile
@KargJonas
KargJonas / focus-search.js
Last active November 2, 2025 13:30
ViolentMonkey script for focussing search bars when you press tab.
// ==UserScript==
// @name Focus Search on Tab
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Focus the main search input when Tab is pressed
// @match *://*/*
// @grant none
// ==/UserScript==
(function() {
### all of these bind the "print" key to take screenshots with slection area using scrot
# use datetime as filename
bindsym --release Print exec --no-startup-id scrot $HOME/Pictures/Screenshots/`date +%Y-%m-%d_%H:%M:%S`.png --select
# ask for filename using dmenu and fall back to datetime if no name provided
bindsym --release Print exec --no-startup-id $HOME/bin/take_screenshot.sh $HOME/Pictures/Screenshots
@KargJonas
KargJonas / .Xmodmap
Created August 28, 2023 07:21
.Xmodmap with Alt_L as Alt_Gr
keycode 8 =
keycode 9 = Escape NoSymbol Escape NoSymbol Escape
keycode 10 = 1 exclam 1 exclam onesuperior exclamdown onesuperior exclamdown 1 exclam onesuperior exclamdown
keycode 11 = 2 quotedbl twosuperior oneeighth twosuperior oneeighth twosuperior
keycode 12 = 3 section threesuperior sterling threesuperior sterling threesuperior
keycode 13 = 4 dollar 4 dollar onequarter currency onequarter currency 4 dollar onequarter currency
keycode 14 = 5 percent 5 percent onehalf threeeighths onehalf threeeighths 5 percent onehalf threeeighths
keycode 15 = 6 ampersand 6 ampersand notsign fiveeighths notsign fiveeighths 6 ampersand notsign fiveeighths
keycode 16 = 7 slash braceleft seveneighths braceleft seveneighths
keycode 17 = 8 parenleft bracketleft trademark bracketleft trademark
@KargJonas
KargJonas / sys.sh
Last active October 27, 2025 12:52
A simple bash script for controlling power, brightness and volume.
#!/bin/bash
# __
# ___ __ _____ ___ / /
# (_-</ // (_-<_ (_-</ _ \
# /___/\_, /___(_)___/_//_/
# /___/
#
# Jonn 2025
@KargJonas
KargJonas / caseSensitiveOuterHTML.js
Created June 20, 2019 15:23
caseSensitiveOuterHTML
function caseSensitiveOuterHTML(element) {
if (element.nodeType === Node.TEXT_NODE) {
return element.wholeText;
}
const tagName = element.tagName;
let attributes = element.attributes;
let children = [...element.childNodes];
if (children.length) {
@KargJonas
KargJonas / isPrime.js
Last active April 8, 2023 15:33
A rather nice way to check if a number is prime.
function isPrime(n) {
if (n < 2) return false;
let divisor = 2;
while (divisor <= n / 2) {
if (n % divisor === 0) return false;
++divisor;
}
// Selecting an element
const counterElement = document.querySelector("#counter");
// Creating a mutable (the "new" is unnecessary, just looks cool)
const state = new Mutable({
count: 0
});
// Subscribing to it (update the content of our element, when mutable changes)
state.$subscribe(() => {
// This script transforms hex numbers in objects to hex-strings (for more elegant style-code)
// The number-to-hex-string conversion
const hex = num => `#${ num.toString(16) }`
// Entries in objects that should be transformed
const TRANSFORM_ENTRIES = [
"backgroundColor",
"color"
];
@KargJonas
KargJonas / inst.md
Last active December 16, 2018 16:40
The Smallest "Framework"

This is all that is needed:

function inst() {
	Array.from(document.getElementsByTagName("comp")).map(element => {
		if (!element.hasAttributes()) return;
		const func = element.attributes[0].name;
		if (!/\w\(.*\)/.test(func)) return;
		element.innerHTML = eval(func);
	});
}
@KargJonas
KargJonas / regex-html-tags.md
Last active May 22, 2021 12:34
RegEx' to select HTML tags.