Skip to content

Instantly share code, notes, and snippets.

@honboubao
honboubao / concatNullable.ts
Last active July 17, 2023 16:30
concatNullable
/**
* Ein fixer String, der in {@link Template} mit anderen Werten verknüpft wird und abhängig von der Gültigkeit der anderen Werte mitangezeigt wird.
*
* Das Trennzeichen darf kein Empty-String sein!
*/
export type Trennzeichen = string; // Empty string als Trennzeichen nicht erlaubt
/**
* Ein Wert, z.B. von einer Variable, der konkateniert werden soll. Ungültige Werte (null, undefined, Empty-String) werden nicht ausgegeben.
* Ungültige Werte beeinflussen ggf. auch die Ausgabe von Trennzeichen im gleichen {@link Template}
@honboubao
honboubao / format.ts
Created May 26, 2023 10:51
JS Concat Template String Function
/**
* Template String Tag Funktion, druckt die eingesetzten Werte im Template und den vorangestellten Verbindungsstrings nur aus, wenn der Wert nicht leer ist.
*
* z.B.
* format`${strasse} ${hausnummer} ${stockTuernummer} / ${abgabestelle} / ${anschriftzusatz}`
*
* => Bambuslichtung 15 / Scheunentor
*
* wenn nur strasse, hausnummer und abgabestelle angegeben sind
#SingleInstance Force
#InstallKeybdHook
TAPPING_TERM := 200
keyboard := ["SC029","SC002","SC003","SC004","SC005","SC006","SC007","SC008","SC009","SC00A","SC00B","SC00C","SC00D","SC00E"
,"SC00F","SC010","SC011","SC012","SC013","SC014","SC015","SC016","SC017","SC018","SC019","SC01A","SC01B","SC01C"
,"SC03A","SC01E","SC01F","SC020","SC021","SC022","SC023","SC024","SC025","SC026","SC027","SC028","SC02B"
,"SC02A","SC02C","SC02D","SC02E","SC02F","SC030","SC031","SC032","SC033","SC034","SC035","SC056","SC136"
@honboubao
honboubao / remap-caps-nav.ahk
Last active June 5, 2021 21:40
AutoHotkey script that maps nav keys and alt gr keys onto hotkeys with caps lock as modifier
#SingleInstance Force
Alt & CapsLock::SetCapsLockState, % (t:=!t) ? "On" : "Off"
CapsLock::return
CapsLock & j::Left
CapsLock & k::Down
CapsLock & l::Right
CapsLock & i::Up
@honboubao
honboubao / remap.ahk
Last active May 28, 2021 11:46
AutoHotkey script that maps arrow keys, home, end and page up/down onto left win key + uiop/jklö block
#SingleInstance Force
*<#j::Send {Blind}{LWin up}{Left}{LWin down}{LCtrl}
*<#k::Send {Blind}{LWin up}{Down}{LWin down}{LCtrl}
*<#l::Send {Blind}{LWin up}{Right}{LWin down}{LCtrl}
*<#i::Send {Blind}{LWin up}{Up}{LWin down}{LCtrl}
*<#u::Send {Blind}{LWin up}{Home}{LWin down}{LCtrl}
*<#o::Send {Blind}{LWin up}{End}{LWin down}{LCtrl}
*<#p::Send {Blind}{LWin up}{PgUp}{LWin down}{LCtrl}
*<#ö::Send {Blind}{LWin up}{PgDn}{LWin down}{LCtrl}
@honboubao
honboubao / StringUtils.java
Last active April 21, 2021 13:22
split/join with escape (Java)
public static class StringUtils {
public static String join(String... parts) {
return Arrays.stream(parts).map(s ->
s.replaceAll(
"\\\\", // regex, replace \
"\\\\\\\\" // with \\
).replaceAll(
"\\|", // regex, replace |
"\\\\|" // with \|
@honboubao
honboubao / cmder_settings.xml
Last active August 28, 2019 09:50
split vertically: Ctrl+Shift+S; split horizontally: Ctrl+Shift+D; new tab: Ctrl+T
<?xml version="1.0" encoding="utf-8"?>
<key name="Software">
<key name="ConEmu">
<key name=".Vanilla" modified="2019-08-22 12:40:39" build="180626">
<value name="Language" type="string" data="en"/>
<value name="StartType" type="hex" data="02"/>
<value name="CmdLine" type="string" data=""/>
<value name="StartTasksFile" type="string" data=""/>
<value name="StartTasksName" type="string" data="{bash::bash}"/>
<value name="StartFarFolders" type="hex" data="00"/>
@honboubao
honboubao / HomeEnd.ahk
Created March 4, 2019 13:59
AutoHotkey script to map the windows key to the function like a laptop keyboard's Fn key to have Fn+arrow keys act as home, end, page up and page down keys.
;
; Home
;
; Win-Left = Home = start of line
#Left::Send {Home}
; Ctrl-Win-Left = Ctrl-Home = start of document
^#Left::Send {LCtrl down}{Home}{LCtrl up}
# mitmproxy addon to serve modified content
# how to use:
# 1. create replace.txt file in your current working directory
# 2. add urls you want to replace to that file, one line per url; urls can be regular expresions; lines starting with # are ignored
# 3. start mitmproxy with parameter -s mitmproxy_replace.py to load this addon
# 4. configure your OS or browser to use your running mitmproxy instance (default port 8080)
# 5. install mitmproxy certificate to allow proxying https by navigating to http://mitm.it/
# 5. navigate to the url you want to replace; a dump of the response content is created in the replace folder in your current working directory
# 6. modify the content dump and reload the page
@honboubao
honboubao / univis_calendar.js
Created July 13, 2014 16:28
Fügt dem Menü im Univis einen Prüfungskalender-Eintrag hinzu, der einen Kalender öffnet, in welchem Prüfungstermine angezeigt werden.
// ==UserScript==
// @name Univis Prüfungskalender
// @namespace hbb_works
// @include https://univis.univie.ac.at/*
// @description Fügt dem Menü im Univis einen Prüfungskalender-Eintrag hinzu, der einen Kalender öffnet, in welchem Prüfungstermine angezeigt werden.
// @grant GM_getValue
// @grant GM_setValue
// @version 1.0r131101
// @require http://code.jquery.com/jquery-2.0.3.min.js
// @require http://arshaw.com/js/fullcalendar-1.6.2/fullcalendar/fullcalendar.min.js