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 | |
# All my gist code is licensed under the MIT license. | |
# gutenberg-dl <search-term> | |
# - Download books from Project Gutenberg in plain text format | |
# - Actually uses "gutendex" to search for the download link. It seems to be | |
# the current best third-party Gutemberg API | |
# - Source: https://github.com/garethbjohnson/gutendex |
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 | |
# All my gist code is licensed under the MIT license. | |
# Add this somewhere in your .bashrc | |
# bkp | |
# - toggle a ".bkp" extension to a file(s) | |
function bkp () { | |
# print usage on -h/--help or no arguments |
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 | |
# All my gist code is licensed under the MIT license. | |
# term2plain | |
# - Convert a text file containing terminal escape sequences to plain text. | |
# - This plain text is close to the visual result of running the file in a | |
# terminal. | |
# - This is achieved by running the file in a virtual terminal (tmux) and | |
# capturing it's buffer output. |
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 | |
# All my gist code is licensed under the MIT license. | |
### UPDATE! | |
# I noticed that this entire solution is unnecessary, as the following | |
# produces the same result, and can be put in the sqlite start file. | |
# ``` | |
# .echo on | |
# .output "| tee -a history.txt" |
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
# explicitly define the interface | |
__all__ = ["minimal_dir"] | |
from functools import cache | |
@cache | |
def get_stdlib_packages(): | |
""" Get list that should include all stdlib package/module names. | |
Not perfect. Has false positives. |
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
# explicitly define the interface | |
__all__ = ["pretty_print"] | |
def is_package_available(package_name): | |
import importlib.util | |
package_spec = importlib.util.find_spec(package_name) | |
return package_spec is not None | |
def pretty_print(label: str, value: any = "") -> None: | |
""" Prints "label". Followed by pretty printed "value". |
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 | |
# All my gist code is licensed under the MIT license. | |
# Add this somewhere in your .bashrc | |
# groff-preview-terminal | |
# - previews roff file in the terminal | |
# - uses grog to figure out needed preprocessor and macros | |
# - sends to terminal output by passing -Tutf8 and then to a pager |
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 | |
# This script listens for new windows and makes them floating if it thinks they | |
# are popups. Meant to be used when regular i3 criteria are not enough to | |
# identify popup windows. It uses hardcoded dimensions. | |
# print usage on --help/-h | |
if [[ "$1" == "--help" || "$1" == "-h" ]]; then | |
echo "Usage: $0" | |
echo "This script listens for new windows and makes them floating if it thinks they" |
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 | |
# Source: https://gitlab.com/wef/dotfiles/-/blob/master/bin/i3-track-prev-focus | |
# https://gitlab.com/wef/dotfiles/-/blob/master/bin/sway-track-prev-focus | |
# shellcheck disable=SC2034 | |
TIME_STAMP="20231126.172745" | |
# Copyright (C) 2020-2021 Bob Hepple <bob dot hepple at gmail dot com> |
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 | |
# ansi colors | |
bold='\033[1m' | |
red='\033[0;31m' | |
green='\033[0;32m' | |
yellow='\033[1;33m' | |
blue='\033[0;34m' | |
reset='\033[0m' |
NewerOlder