This file contains hidden or 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
| # Add this to the end of your .bashrc to automatically open tmux | |
| if [ -z "${TMUX:-}" ] && [ -n "${SSH_TTY:-}" ] && [[ $- =~ i ]] && command -v tmux &>/dev/null; then | |
| ID="$(tmux 'ls' 2>/dev/null | grep -vm1 attached | cut -d: -f1)" # get the id of a deattached session | |
| if [[ -z "$ID" ]]; then | |
| exec tmux new-session # if not available attach to a new one | |
| else | |
| extra=() | |
| if [ "$(tmux 'ls' | grep -cv attached)" -gt 1 ]; then | |
| extra=(';' choose-tree -sZ) # if there's more than one detached session, choose between them | |
| fi |
This file contains hidden or 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
| [Unit] | |
| Description=enable wifi on startup | |
| After=NetworkManager.service | |
| [Service] | |
| ExecStart=/usr/bin/nmcli radio wifi on | |
| [Install] | |
| WantedBy=multi-user.target |
This file contains hidden or 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 | |
| set -euC -o pipefail | |
| user_shell=$SHELL # This is the user's login shell, or the path to bash if unset. This is usually set by login. | |
| _TMPDIR=~/.tmp | |
| this=${BASH_SOURCE[0]:-$0} | |
| this=${this##*/} # this is the name of the script without the path | |
| log() { printf '%s\n' "$@" || true; } | |
| err() { printf 'Error: %s\n' "$@" 2>&1 || true; } |
This file contains hidden or 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
| import argparse | |
| import itertools | |
| from pathlib import Path | |
| import subprocess | |
| import json | |
| from argparse import ArgumentParser | |
| from datetime import datetime | |
| def error(text: str): |
This file contains hidden or 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 | |
| set -euC -o pipefail && shopt -s nullglob globstar | |
| utils=script_utils.sh dir=$(dirname -- "${BASH_SOURCE[0]}") || true | |
| if [ -f "$dir/$utils" ]; then utils="$dir/$utils"; fi | |
| # shellcheck source=./script_utils.sh | |
| . "$utils" | |
| function usage() { | |
| cat <<EOF || true | |
| Usage: $THIS [PATTERN]... |
This file contains hidden or 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 | |
| set -euC -o pipefail | |
| version=17.5.0 | |
| vmware_lib="/usr/lib/vmware/modules/source" | |
| product="$(vmware-installer -l 2>/dev/null | tail -n1 | cut -f1 -d' ')" || true | |
| if [ -n "$product" ]; then | |
| echo "Uninstalling $product" | |
| sudo vmware-installer -u "$product" |
This file contains hidden or 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 | |
| function verbose() { | |
| echo "> $*" | |
| "$@" | |
| } | |
| tmp=$(mktemp -d) | |
| echo "tmpdir: $tmp" | |
| touch -- "$tmp/a file with spaces" | |
| for i in {1..40}; do touch -- "$tmp/long-file-name-$i"; done |