Skip to content

Instantly share code, notes, and snippets.

#! /usr/bin/perl -w
#
# Copyright (c) 2000-2014 SUSE Linux AG, Nuernberg, Germany.
# All rights reserved.
########################################################################
# create a man-page with:
#
# pod2man --section 1 --center=" " fonts-config | gzip -9 -c > fonts-config.1.gz
# cp fonts-config.1.gz /usr/share/man/man1/fonts-config.1.gz
fish_path() {
setopt localoptions rcquotes nullglob
local result part; local -a tree expn; local -i i
(
tree=(${(s:/:)${1-${PWD/#$HOME/\~}}})
if [[ $tree[1] == \~* ]] {
cd -q ${~tree[1]}
result=$tree[1]; shift tree
} else { cd -q / }
for dir in $tree; {
@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
@Trucido
Trucido / Pscx.Vhd.psm1
Created November 4, 2018 03:31
Description for Pscx.Vhd.psm1
<#
#>
function ScriptDiskPart($script)
{
$file = [io.path]::GetTempFileName()
try
{
Set-Content $file $script -Encoding utf8
& diskpart /s $file > $null
<#
.Synopsis
Enumerates the parameters of one or more commands.
.Description
Lists all the parameters of a command, by ParameterSet, including their aliases, type, etc.
By default, formats the output to tables grouped by command and parameter set.
.Parameter CommandName
The name of the command to get parameters for.
.Parameter ParameterName
Wilcard-enabled filter for parameter names.
#!/bin/bash
#
# /sbin/service Handle boot and runlevel services
#
VERSION="18.02.16"
sd_booted()
{
test -d /sys/fs/cgroup/systemd/
# autoload
alias "$1"="${aliases[$1]:-$1} $argv[2,-1]"
# -*- mode: Shell-Script; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sts=2 ts=2 sw=2 et fdm=marker fmr={{{,}}}
@Trucido
Trucido / title.zsh
Last active December 14, 2018 23:30
########################################
# __vte_osc7() vte support
########################################
if [[ ${VTE_VERSION:-0} -ge 3405
&& -z ${precmd_functions[(r)__vte_osc7]}
&& ( -o interactive || $- == *i* )
&& $TERM == (xterm*|[Vv][Tt][Ee]*) ]]
then
__vte_urlencode() (
emulate -L zsh
#autoload
#function realpath {
emulate -L zsh -o extendedglob -o function_argzero # -o SOURCE_TRACE -o XTRACE -o VERBOSE
typeset f='' o=''
(($#)) || {
print -u2 "$0: missing operand\nUsage: $0 path [path ...]";
return 1
@Trucido
Trucido / fishl.sh
Created December 17, 2018 08:04
fishy script
#!/bin/bash
# fishl.sh - safely change shells to fish while fixing its fishy command_not_found_handler
# Alternatively, null cnf handler can be used:
# 'function __fish_command_not_found_handler --on-event fish_command_not_found; end'
if test -x /usr/bin/fish ; then
fishl () (
/usr/bin/env -i \
SHELL=/usr/bin/fish \
TERM="${TERM}" \