Skip to content

Instantly share code, notes, and snippets.

@Trucido
Trucido / foo.sh
Created April 7, 2018 19:01
PROMPT_COMMAND
if [ -z "$PROMPT_COMMAND" ]; then
case $TERM in
xterm*|vte*)
# check /etc/sysconfig and /etc/default for expert custom file first
# Debian example: 'echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
elif [ -e /etc/default/bash-prompt-xterm ]; then
PROMPT_COMMAND=/etc/default/bash-prompt-xterm
elif [[ -e "${XDG_CONFIG_HOME:-$HOME/.config}/bash-prompt-xterm" ]]; then
# ~/.rc/bash_prompt.sh
# Check that we're zsh and real bash not sh bash
case "$(readlink /proc/$$/exe 2>/dev/null)" in
*/bash) ! shopt -oq posix || return;;
*/zsh) ;;
*) return;;
esac
# Interactive only
[[ $- == *i* ]] || return
#!/bin/bash
#
# /etc/init.d/zswap || zswap.service || /usr/local/sbin/zswap || somethingsomething
#
### BEGIN INIT INFO
# Provides: zswap
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
@Trucido
Trucido / 50-coredump.conf
Last active March 16, 2019 00:45
Disable systemd dumps
# /etc/sysctl.d/50-coredump.conf
##################################################################################
## NO DUMPING ALLOWED ##
## VIOLATORS WILL BE PROSECUTED ##
##################################################################################
fs.suid_dumpable = 0
kernel.suid_dumpable = 0
kernel.core_pattern = |/bin/false
@Trucido
Trucido / openSUSE-Leap-42.3-pam_kwallet-guide.md
Last active March 22, 2025 23:24 — forked from benediktg/pam_kwallet-guide.md
How to configure pam_kwallet to auto-unlock kdewallet from sddm login credentials on openSUSE Leap 42.3 KDE Plasma5

How to configure pam_kwallet to auto-unlock the default kwallet5 "kdewallet" from sddm login credentials on openSUSE Leap 42.3 KDE Plasma5

Note: Many other guides & posts were attempted before creating this, however they either no longer work or are ugly hacks which don't follow SUSE's odd pam.d layouts. Essentially, this solution boils down to this: pam_kwallet needs to be loaded from it's own substack just like pam_gnome_keyring already is configured to do so, so new substacks were created based on the gnome_keyring ones so that they could be added to sddm. I'm unsure how both gnome_keyring and kwallet behave if both are loaded from the same substack so I kept them in separate stacks. This was tested with only kwallet5 installed but it should also optionally load the old kwallet4 if it's present. My understanding of PAM is limited, so I'm open to suggestions, but this seemed like the cleanest solution which doesn't get overwritten on updates, though it should probably be globally registered as a

@Trucido
Trucido / reinstall-dkms-modules-pluszfs.sh
Last active September 12, 2018 03:50
ugly hacky script to rebuild all dkms modules plus manually force zfs if it's intree for debian/ubuntu
#!/usr/bin/env bash
# rebuild/reinstall all dkms modules.
# double check there's no others missing too afterwards.
#template(){
#KVER=x.x.x-arch
#ZVER=x.x.x.x-x
#dkms status | sed s/,//g | awk '{print "--force -m",$1,"-v",$2}' | while read line; do ls /var/lib/initramfs-tools | xargs -n 1 dkms build --force $line -k; done
#dkms status | sed s/,//g | awk '{print "--force -m",$1,"-v",$2}' | while read line; do ls /var/lib/initramfs-tools | xargs -n 1 dkms install --force $line -k; done
#dkms build --force -m spl -v $ZVER -k $KVER
## /etc/udev/rules.d/80-udisks2-ignore-zfs.rules
# Ignore ZFS vdev filesystem type "zfs_member" with partition ID "Solaris /usr & Apple ZFS"
ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_FS_TYPE}=="zfs_member", ENV{ID_PART_ENTRY_TYPE}=="6a898cc3-1dd2-11b2-99a6-080020736631", ENV{UDISKS_IGNORE}="1"
@Trucido
Trucido / gut-multicore-sys-monitor-net.sh
Created April 11, 2016 14:43
gut net portion of multi-core-system-monitor cinnamon applet to fix high cpu usage due to dbus/polkit spam
#!/bin/bash
### notes/instructions ###
# gut net portion of multi-core-system-monitor cinnamon applet to fix high cpu usage due to dbus/polkit spam
# Instructions: disable the applet before doing this then re-enable it afterwards.
# I'll probably fork this someday to fix it but lazy right now.
# if something goes wrong or you want to revert it, just "mv applet.js.bak applet.js"
### commands start ###
cd ~/.local/share/cinnamon/applets/multicore-sys-monitor@ccadeptic23/
@Trucido
Trucido / opera-tmp-cache.sh
Created June 10, 2015 21:27
move opera cache to /tmp/cache for tmpfs
#!/bin/bash
#
# Copyright (c) 2015 Tara Nupsumass
# This script is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This script is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@Trucido
Trucido / firefox-tmp-cache.sh
Created June 10, 2015 20:07
move firefox cache to /tmp/cache for tmpfs
#!/bin/bash
#
# Copyright (c) 2015 Tara Nupsumass
# This script is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This script is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of