Skip to content

Instantly share code, notes, and snippets.

@Trucido
Trucido / openSUSE-Leap-42.3-pam_kwallet-guide.md
Last active October 14, 2023 18:32 — 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

## Get-WSLPaths
<#
.SYNOPSIS
Gets paths and names of WSL distributions installed from Windows Store.
If no parameters supplied, it prints all installed WSL distributions.
.EXAMPLE
PS> Get-WSLPaths debian
PackageFullName : TheDebianProject.DebianGNULinux_1.1.6.0_x64__76v4gfsz19hv4
InstallLocation : C:\Program Files\WindowsApps\TheDebianProject.DebianGNULinux_1.1.6.0_x64__76v4gfsz19hv4
rootfsPSPath : ${env:LOCALAPPDATA}\Packages\TheDebianProject.DebianGNULinux_76v4gfsz19hv4\LocalState\rootfs
which2() {
[ -t 1 ] && {
case "${BASH##*/}${ZSH_NAME}" in
(bash) {
{ [ "`builtin type -t $1 2>/dev/null`" = "builtin" ] >&/dev/null; } && \
{ printf '%s is a shell builtin\n' "$1"; return; }
}
{
{ (alias;typeset -f) | \which --tty-only --read-alias --read-functions --show-tilde "$@" >&/dev/null; } && \
{ (alias;typeset -f) | \which --tty-only --read-alias --read-functions --show-tilde "$@" && return $?; }
#!/bin/sh
# -*- mode:shell-script sh-basic-offset:4 indent-tabs-mode:nil -*-
########################################################################################################################
# zswap.sh - Activate and tune Zswap compressed cache for swap pages.
#
# Enables/Renables/tunes zswap without the need for initramfs/dracut/modprobe/modules-load hackery.
#
# Author : <REDACTED>
# Copyright: 2018 <REDACTED> <########@####.com>
#
if ((! ${+precmd_functions[(r)__vte_osc7|title_precmd]}${+preexec_functions[(r)title_preexec]}))
then
function title {
[[ ( ! -o interactive || $- != *i* ) || $EMACS == *t* ]] && return
emulate -L zsh -o promptsubst -o extendedglob
: ${2=$1}
case ${TERM} in
[aEkx]term*|(#i)rxvt*|(#i)vte*|(#i)cygwin*|(#i)[pk][ui]tty*)
print -Pn "\e]2;$2:q\a"; print -Pn "\e]1;$1:q\a" ;;
# ~/.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
# .bashrc -*- mode:shell-script sh-basic-offset:4 indent-tabs-mode:nil -*-
#
#
# Sanity checks
#
[ -n "$BASH_VERSION" -a -n "$BASH" ] || return 0
# Always set histfile to avoid clobbering other shells.
HISTFILE=${HOME}/.bash_history
# Test for corner cases in shells sourcing this file.
# .bash_prompt
BASE0=$'\E[38;5;244m'
BASE00=$'\E[38;5;241m'
BASE01=$'\E[38;5;240m'
BASE02=$'\E[38;5;235m'
BASE03=$'\E[38;5;234m'
BASE1=$'\E[38;5;245m'
BASE2=$'\E[38;5;254m'
BASE3=$'\E[38;5;230m'
# adapted from http://hg.python.org/cpython/file/2.7/Lib/getopt.py
# argv:
# array of arguments
# shortopts:
# string of single-letter options. options that take a parameter
# should be follow by ':'
# longopts:
# array of strings that are long-form options. options that take
# a parameter should end with '='
# returns @(opts hash, remaining_args array, error string)
## Convert-StarDate.ps1
#Requires -Version 3
<#
.SYNOPSIS
Calculates the stardate.
.DESCRIPTION
Returns the current stardate with no parameters, or you can enter a specific date as a string or as a DateTime `
object and Get-Stardate will return the stardate for that time.