This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Runs a command wrapped in ZFS pre-post snapshots. The whole data pool is recursively snapshotted. | |
# Analogous to my snp script for BTRFS: https://gist.github.com/erikw/5229436 | |
# Usage: $ znp <commands> | |
# e.g.: $ znp pgk upgrade | |
# e.g.: $ znp portmaster -aG | |
# e.g.: $ znp freebsd-upgrade install | |
zfs_pool=zroot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Interactively upgrade my homebrew system. | |
# Usage: brew_upgrade.sh | |
# Requirements: | |
# - Install cask upgrade command with: $ brew tap buo/cask-upgrade | |
# Exit script on SIGINT. | |
set -e | |
CLI_PREFIX="📦$(tput setaf 1) ======>$(tput sgr0)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MOVED TO ⮕ https://github.com/erikw/restic-automatic-backup-scheduler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Runs a command wrapped in btrfs snapper pre-post snapshots. | |
# Usage: $ snp <commands> | |
# e.g.: $ snp pacman -Syyu | |
# Requirements: snapper (https://wiki.archlinux.org/title/snapper) | |
# The latest version of this script is hosted at https://gist.github.com/erikw/5229436 | |
log_path="/var/local/log/snp" | |
date=$(date "+%Y-%m-%d-%H%M%S") | |
log_file="${log_path}/snp_${date}.log" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
trim_method="roll" # Can be {trim or roll). | |
max_len=30 # Trim output to this length. | |
roll_speed=2 # Roll speed in chraacters per second. | |
segment_path=$(dirname $0) | |
source "$segment_path/../lib.sh" | |
np="A pretty long line for a song title eh?" | |
np=$(roll_text "${np}" ${max_len} ${roll_speed}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source this file where ANSI colors are needed. Colors in strings should be quoted with "" and echos needs to interpret backslash (echo -e). | |
# Reference: http://www.faqs.org/docs/Linux-HOWTO/Bash-Prompt-HOWTO.html#AEN341 | |
function export_colors() { | |
# ANSI colors codes. | |
local DULL=0 | |
local BRIGHT=1 | |
local FG_NULL=00 | |
local FG_BLACK=30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Announce current song playing in mpd in a KDE notification. | |
# Icon support for passivepopup is implemented in more recent versions of KDE. | |
#path=`mpc -f %file% | head -n1 | sed 's/\(.*\)\/.*\..\+$/~\/mult\/music\/\1/'` | |
#icon=`find $path -type f -iregex '.*\.\(png\|jpg\|jpeg\|gif\|bmp\)$' -print | head -n1` | |
#kdialog --icon "$icon" --title "Currently playing song" --passivepopup "$np" 3 | |
#np=`mpc --format "%title%[\n%album%]\n%artist%" | head -n3` | |
np=`mpc --format "%title%[\n%album%]\n%artist%" | grep -Pzo '^(.|\n)*?(?=\[)'` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Toggle spell with a language. {{{ | |
function! ToggleSpell(lang) | |
if !exists("b:old_spelllang") | |
let b:old_spelllang = &spelllang | |
let b:old_spellfile = &spellfile | |
let b:old_dictionary = &dictionary | |
endif | |
let l:newMode = "" | |
if !&l:spell || a:lang != &l:spelllang |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grep -Pzoi "(?<=>)[3-5G] </td>(\s*(?:\\n|<td[^>]*>[^<]*</td>))*\s*<\/tr>\s*<tr>\s*<td[^>]*>[^<]*</td>\s*<td[^>]*>examiner" < LADOK.HTML | grep -Pzoi "^[3-5G](?= </td>)" | sed -e 's/g/3/i' | awk 'BEGIN{sum=0;count=0}{sum+=$1;count++}END{print sum/count}' |
NewerOlder