Skip to content

Instantly share code, notes, and snippets.

View HikariKnight's full-sized avatar
💭
I may be slow to respond.

HikariKnight HikariKnight

💭
I may be slow to respond.
View GitHub Profile
@HikariKnight
HikariKnight / virtual-channels.conf
Created April 30, 2023 15:53
Place this file inside ~/.config/pipewire/pipewire.conf.d/ to create virtual channels for different applications for streaming or for audio isolation
context.modules = [
{ name = libpipewire-module-loopback
args = {
node.description = "Game"
capture.props = {
node.name = "game_output"
media.class = "Audio/Sink"
audio.position = [ FL FR ]
}
playback.props = {
@HikariKnight
HikariKnight / KH3.gamecontroller.amgp
Last active June 7, 2022 07:27
AntimicroX profile for Kingdom Hearts 3 on PC (for use to add "controller support" in linux)
<?xml version="1.0" encoding="UTF-8"?>
<gamecontroller configversion="19" appversion="3.2.3">
<!--The SDL name for a joystick is included for informational purposes only.-->
<sdlname>Xbox One S Controller</sdlname>
<!--The Unique ID for a joystick is included for informational purposes only.-->
<uniqueID>030000005e040000fd020000000068001118765</uniqueID>
<stickAxisAssociation index="2" xAxis="3" yAxis="4"/>
<stickAxisAssociation index="1" xAxis="1" yAxis="2"/>
<vdpadButtonAssociations index="1">
<vdpadButtonAssociation axis="0" button="12" direction="1"/>
@HikariKnight
HikariKnight / snapshot_take
Last active January 21, 2022 06:50
Custom btrfs snapshots for when you need different naming schemes than timeshift or snapper and keep them for 1 month
#!/bin/bash
TIMESTAMP=`date +"%Y.%m.%d-%H.%M.%S"`
SNAP="btrfs subvolume snapshot -r"
SOURCE_DIR="/Tank/data"
SNAP_DIR="/Tank/data/.snapshots"
SNAP_NAME="@GMT_$TIMESTAMP"
$SNAP $SOURCE_DIR $SNAP_DIR/$SNAP_NAME
rm -rf $SNAP_DIR/.snapshots/@SNAP_NAME/.snapshots/*
@HikariKnight
HikariKnight / pkexec
Last active September 5, 2021 01:45
A "pkexec" replacement for use in wsl2 until microsoft fixes policykit in wsl2 (DO NOT USE FOR PRODUCTION)
#!/bin/bash
# Dependencies: zenity
#
# Installation: download the file, name it "pkexec" and make it executable, then put it in /usr/local/bin
# This should in theory auto "fix" programs like synaptic which launches using pkexec from its desktop file.
#
# THIS SCRIPT IS NOT A PROPER REPLACEMENT, SENDING THE PASSWORD THROUGH SUDOS STDIN IS NOT SECURE!
# THIS IS MEANT AS A TEMPORARY WORKAROUND, DO NOT USE IN PRODUCTION!
exec sudo -HSkp '' -- $@ <<<$(zenity --password --title=Authentication) 2>/dev/null
@HikariKnight
HikariKnight / pachannels
Created December 25, 2020 19:50
a login script i run on login to load separate audio channels i defined in ~/.pulse/default.pa
#!/bin/bash
# Unload any loaded loopback modules (start with blank slate)
pacmd unload-module module-loopback
####
# The comments below are the definitions from ~/.pulse/default.pa
# Followed by the "pacmd" command used to load that specific sink as a loopback module
####
## Make a dummy sink for voice
@HikariKnight
HikariKnight / .bashrc
Last active July 11, 2020 09:36
personal bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@HikariKnight
HikariKnight / pxeboot.mas
Last active March 6, 2022 14:01
pxeboot.mas file to include in /usr/share/zentyal/stubs/dhcp/subnet.mas for when you use fog server for pxe booting
<%doc>
This template generates a better tftp filenames based on architecture
for PXE booting.
Place this file in /usr/share/zentyal/stubs/dhcp
Include it by adding
<& pxeboot.mas, options => \%options &>
into the "if ($options{filename}) {" section of subnet.mas and comment out the
filename "<% $options{filename} %>"; line
</%doc>
@HikariKnight
HikariKnight / Split audio guide.md
Last active May 14, 2020 19:18
Split audio from programs in pulseaudio

First copy default.pa to ~/.pulse if you do not have it there already

mkdir ~/.pulse
cp /etc/pulse/default.pa ~/.pulse/

Open ~/.pulse/default.pa in a text editor and add this for each audio channel you want

# Make a dummy sink for split audio
load-module module-null-sink sink_name=sinkname
#!/bin/bash
# Dependency: termdown
# pip3 install termdown
# I recommend to install termdown inside a python3 venv that you have in your $PATH instead of on your system python
if [[ $@ == "" ]]
then
termdown -f roman -T "Be Right Back" 5 && termdown -f roman -T 'Chris is LATE !'
elif ! [ $1 -eq $1 ] 2>/dev/null
then
@HikariKnight
HikariKnight / emoji-toggle.md
Last active July 5, 2020 18:06
ibus emoji toggle
#!/bin/bash
#### CONFIG
ibus_default_layout="xkb:no::nor"
layout="no"
#### END OF CONFIG

ibus_layout=$(ibus engine)
if [[ "$ibus_layout" == $ibus_default_layout ]]; then
 echo Setting ibus to uniemoji