Spyke

Posts

bun_alert_system·Bun Alert Systembyconfusedpuppy

Protest the power

My parents and neighbour are demanding the destruction of my bunny garden. The patch of grass and native plants that grows next to my garden. The patch of grass where the bunnies chill during the day when the sun is high.

I'm protesting. The bunny garden must stay. These old people are gonna have to fight me before they touch a blade of grass from my bunny garden.

You got a problem with buns and you got a problem with me. Plus I got a whole lot of native chickweed seeds and clover seeds. I'm ready to escalate and bomb both lawns with 'em.

View original on lemmy.dbzer0.com
101

rTransfer: An rsync command line helper tool

Last year I created an rsync tool for myself. In short, It's purpose was to build rsync commands within a config file and use those files to build and run rsync commands. I preferred this over the every growing list of rsync commands I was experiencing. Making aliases for everything and keeping commands unified and neat was becoming overwhelming for myself.

Recently I've been sick so I used my free time to completely rewrite the script using all the knowledge I've learned over the last year writing some other scripts. I took out some features that were too specific, made the code much cleaner and easier to maintain and made the visual output easier to read and understand.

The script has a number of additional features including:

  • Running multiple config files from a single command
  • The base command will do a dry run to allow you to preview changes before committing to a transfer
  • An option to quickly do a dry run to simply view any changes
  • An option to quickly reverse the source/destination transfer direction
  • An option to ignore the dry run and instantly perform a sync
  • The ability to create a template config file that's (hopefully) easy to read and fill out
  • Feedback for a number of common issues so that the rsync command will not run, hopefully avoiding any data loss issues
  • An option to print out the full rsync command built from a config file (sometimes I want to move a specific file without creating a new, one time use config file)
  • Built with ssh and ssh key files in mind
  • Single file and POSIX portable with rsync as it's only dependency
  • Long command option names for easier scripting

One notable change I made from my first script and the rewrite was using the sed command to gather information from the config files instead of directly sourcing into the main script. It's slightly less efficient but more secure than accidentally running commands while using the source (.) command. I'm still trying to figure out how to make it slightly more efficient but for now it works how I like it to work.

I've had such terrible luck with fully featured syncing programs (Syncthing for example) and have always had much better consistency with rsync (at the loss of bi-directional, continuous syncing). I also hated building rsync commands so this tool has been a great compromise for myself.

https://codeberg.org/taters/rTransferOpen linkView original on lemmy.dbzer0.com
8

My POSIX portable working example/code library script

The Script

While researching and learning different tasks to do for my personal scripts, I tried keeping my code examples in different files in a directory. It was very unorganized and a bit overwhelming to deal. Instead I started writing a script that functions as a library for all the things I have learned.

The script keeps everything in one spot and it's much easier to work on it. It also acts as a functioning style guide for myself so I can standardize my own future scripts. It's also easy to add code or work on existing code. I usually have it open whenever I am writing something new to use as a quick reference guide.

Some of the features I have worked on include:

  • Making it easier to use POSIX getopts. I can easily add long options. I also made it simple for me to process arguments or deal with conflicting options.
  • Working with simple "arrays" (positional parameters). There's a nice little function that can save the array to a variable which can then be set again to be used in different parts of the script.
  • a Yes/No confirmation function which can accept a y or n character instantly without pressing enter to proceed.
  • A few of examples extracting data from variables using variable expansions
  • An enter password function that works similar to the read -rscommand
  • A couple examples of using the trap command to help reset changes made during a script

I tried my best to make it easy and obvious to understand. I know future me would get annoyed trying to relearn something I worked on before when I am focused on the script I want to write currently.

I'm learning more about the very basic commands of Linux which is why I prefer writing POSIX portable scripts over Bash scripts. Deconstructing read -rs is a good example. I got to play around with the stty command and learn a couple things about terminal settings.

It's a nice, simple and ongoing project. Maybe there is something useful in there for anyone else writing POSIX portable scripts. I would like to learn a little about awk and sed in the future but I haven't found a project yet where that can be used.

View original on lemmy.dbzer0.com
9

A POSIX script for mounting an encrypted device

Last year while I was learning to self-host some services on a Raspberry Pi I came across Alpine Linux. The very minimal environment of Alpine Linux was something that really interested me. Somewhere along the way I started writing scripts. Since Bash wasn't my default shell and I was missing a lot of other programs that would normally be pre-installed under other distributions, I unintentionally started writing POSIX portable scripts.

I continued writing with POSIX in mind because I not only found it interesting but it was also giving me a better understanding of how Linux works under the hood. I was always curious about how windows worked when I was using it but it always seemed so much more complex and intimidating.

This specific script I wrote was meant to make mounting and unmounting a LUKS encrypted device from the command line easier and a bit safer. Eventually I extended the functionality to automatically decrypt, mount, execute a command, unmount and reencrypt the device in one single command.

My reasoning for this is because I use external encrypted USB drives to backup my computer, phone and two RPi devices. I wanted to still enter my passphrase but I didn't want to forget to reencrypt my device after updating the backup.

Some of the things I learned while writing this script in particular was working with getopts and changing terminal settings with stty. There are a bunch of other small things I learned to work around the limited tools I had available but it would be too much to try and list them all.

With getopts I managed to find a few ways to make it manageable and easy to work with long options. That makes it much easier to use this script within other scripts since I don't have to remember what each single character short option name does. The limitation with getopts and long option names is that the long option requires an '=' character but it works consistently which is what matters to me.

With stty I learned how to disable and reenable job control (default CTRL+Z in a terminal) as a way to prevent the script from being interrupted and leaving the device unencrypted because the script couldn't continue with the unmounting trap command.

I spent a couple months of my free time working on this script but it's at the point where I am comfortable and very happy with how it turned out. It's a single file, POSIX portable and only requires cryptsetup as it's only dependency.

I'll apologize for the commenting in advance, I find the shouty comments help me understand what's happening with the script better than trying to remember what each command or variable does. It's also might seem silly in some places but it's consistent which is also important to me.

The Script: emountman

View original on lemmy.dbzer0.com
9

Welcome home

::: spoiler How it started


Tool

Drawing:

2222222222222222222222222222222222222222222222222222
2222222222221112222222222222222222222222222222222222
2222222222211111222222222222222222222222222222222222
2222222221111111112222222222222222222222222222222222
2222222111111111111122222222222222222222222222222222
2222221111111 11111112222222222222222222222222222222
222221111111 o 1111111222222222222222222222222222222
222222111111 | 1111112222222222222222222222222222222
222222211111 | 1111122222222222222222222222222222222
222222221111 ^ 1111222222222222222222222222222222222
22222222211 / \ 112222222222222222222222222222222222
22222222222 | | 222222222222222222222222222222222222
22222222222 | | 222222222222222222222222222222222222
22222222222 | | 222222222222222222222222222222222222
2222222222 /   \ 22222222222222222222222222222222222
222222222 |  _  | 2222222222222222222222222222222222
22222222 _| |_| |_ 222222222222222222222222222222222
2222222 |    _    | 22222222222222222222222222222222
00000000|   |_|   |000000000000000000000000000000000
00000000|    _    |000000000000000000000000000000000
000000__|   |_|   |__0000000000000000000000000000000
00000/       _       \000000000000000000000000000000
0000|  BT   |_|  CORP |00000000000000000000000000000
0000|  _     _     _  |00000000000000000000000000000
0000| |_|   |_|   |_| |00000000000000000000000000000
0000|  _     _     _  |00000000000000000000000000000
0000| |_|   |_|   |_| |00000000000000000000000000000
0000|  _     _     _  |00000000000000000000000000000
0000| |_|   |_|   |_| |00000000000000000000000000000
0000|        _        |00000000000000000000000000000
0000|_______|_|_______|00000000000000000000000000000
000000000000| |0000000000000000000000000000000000000
____________| |__________________0000000000000000000
 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _    \00000000000000000
______________________________  \  |0000000000000000
000000000000000000000000000000\    |0000_________000
0000000000000000000000000000000| | |000|         |00
0000000000000000000000000000000|   |000| Welcome |00
0000000000000000000000000000000| | |000|   To    |00
0000000000000000000000000000000|   |000| Beiging |00
0000000000000000000000000000000| | |000|_________|00
0000000000000000000000000000000|   |00000|00000|0000
0000000000000000000000000000000| | |00000|00000|0000

:::

::: spoiler How it's going


Aaah. :::

View original on lemmy.dbzer0.com
22

Your disengagement will be televised

Source code, or something that looks like it

::: spoiler Drawing, or something that looks like it


   _______________________________________________
  /                                               \
 |    _________________________________________    |
 |   |+++++++++++++++++++++++++++++++++++++++++|   |
 |   |+++++++++++++++++++++++++++++++++++++++++|   |
 |   |+++++++++++++++++++++++++++++++++++++++++|   |
 |   |+++++++++++++++++++++++++++++++++++++++++|   |
 |   |+++++++++++++++++++++++++++++++++++++++++|   |
 |   |+++++++++++++++++++++++++++++++++++++++++|   |
 |   |+++++++++++++++++CONTENT+++++++++++++++++|   |
 |   |+++++++++++++++++++++++++++++++++++++++++|   |
 |   |+++++++++++++++++++++++++++++++++++++++++|   |
 |   |+++++++++++++++++++++++++++++++++++++++++|   |
 |   |+++++++++++++++++++++++++++++++++++++++++|   |
 |   |+++++++++++++++++++++++++++++++++++++++++|   |
 |   |+++++++++++++++++++++++++++++++++++++++++|   |
 |   |_________________________________________|   |
 |                               BeigeTech Corp.   |
  \_______________________________________________/
      /  \_________________________________/
     /
    (___________________________________________
    |  ___________________  __________________  |
    | |                   ||                  | |
    | |                   ||                  | |
    | |      ENGANGE      ||       DIE        | |
    | |                   ||                  | |
    | |___________________||__________________| |
    |___________________________________________|

::: Art, or something that looks like it

::: spoiler Sanity, or something that looks like it


:::

View original on lemmy.dbzer0.com
55

Kinky

::: spoiler Source code


#!/bin/sh



# Setup:
# $ chmod +x painterm

# Usage:
# $ . painterm "/path/to/file"

# Description:
# - Reads an ANSCII picture within a file and converts selected characters to
#   the specified character with optional colour tiles

# Features:
# - Extremely inefficient
# - Option to add randomized colour tiles



# SHELLCHECK
# shellcheck disable=SC2034 # Warning for unused variables
# shellcheck disable=SC2086 # Warning for globbing/word splitting



##### USER VARIABLES
# - FILE LOCATION
#   - Set by first command line script argument
file_location="${1}"
# - RANDOM NUMBER CREATOR INTERVAL
#   - Higher number = faster preloading of randomized numbers
number_creator_interval=1000



##### FUNCTIONS
select_random_colour() { # NOTE Arguments: "${current_random_number}"
# COLOUR SELECTION

    # VARIABLES
    colour="${1}"
    # - COLOURS
    colour0="\033[30m\033[41m"
    colour1="\033[31m\033[42m"
    colour2="\033[32m\033[41m"
    colour3="\033[33m\033[42m"
    colour4="\033[34m\033[42m"
    colour5="\033[35m\033[44m"
    colour6="\033[36m\033[44m"
    colour7="\033[37m\033[44m"
    colour8="\033[44m"
    colour9="\033[33m\033[44m"

    # CODE
    # CHOOSE COLOUR BASED ON CURRENT VARIABLE DIGIT [0-9]
    if [ "${colour}" ]; then
        case "${colour}" in
        0)
            printf "%b" "${colour0}"
        ;;
        1)
            printf "%b" "${colour1}"
        ;;
        2)
            printf "%b" "${colour2}"
        ;;
        3)
            printf "%b" "${colour3}"
        ;;
        4)
            printf "%b" "${colour4}"
        ;;
        5)
            printf "%b" "${colour5}"
        ;;
        6)
            printf "%b" "${colour6}"
        ;;
        7)
            printf "%b" "${colour7}"
        ;;
        8)
            printf "%b" "${colour0}"
        ;;
        9)
        printf "%b" "${colour1}"
        ;;
        esac
    fi
}

initialization() {
# CHECK SCRIPT FOR ERRORS WITH SHELLCHECK (IF AVAILABLE) AND OTHER REQUIREMENTS

    # CHECK IF SHELLCHECK IS INSTALLED
    if [ -n "$(command -v "shellcheck")" ]; then
        # IF INSTALLED, RUN SHELLCHECK AND EXIT IF ERRORS ARE FOUND
        if ! shellcheck painterm; then
            return 1
        fi
    fi

    # CHECK IF FILE LOCATION ARGUMENT IS EMPTY
    if [ -z "${file_location}" ]; then
        # IF EMPTY, DISPLAY ERROR MESSAGE AND EXIT
        printf "Argument required: File location\n"
        return 1
    fi

    # CLEAR SCREEN IF ALL CHECKS PASS
    clear
}

main() { # NOTE Arguments: "<file location>"
# MAIN SCRIPT

    # VARIABLES
    create_random_numbers=
    random_numbers_total=

    # CODE
    # CHECK IF CHARACTER COUNT IN FILE IS MORE THAN 0 CHARACTERS
    while [ -n "$(wc -c ${file_location} | tr -dc '[:digit:]')" ]; do
        # CREATE NEW SET OF RANDOM NUMBERS (VALUE BASED ON VARIABLE "${number_creator_interval}")
        create_random_numbers="$(cat < /dev/urandom | tr -dc '[:digit:]' | fold -w "${number_creator_interval}" | head -n 1)"
        # CHECK IF TOTAL COUNT OF RANDOM NUMBERS ARE LESS THAN FILE CHARACTER COUNT
        if [ "${#random_numbers_total}" -lt "$(wc -c ${file_location} | tr -dc '[:digit:]')" ]; then
            # IF LESS, ADD NEW SET OF RANDOM NUMBERS TO TOTAL
            random_numbers_total="${random_numbers_total}${create_random_numbers}"
            printf "."
        else
            # IF MORE, CLEAR SCREEN & STOP & CONTINUE WITH SCRIPT
            clear
            break
        fi
    done

    # VARIABLES
    file="${1}"
    line_i=0
    line_count="$(cat ${file} | wc -l)"
    char_i=0
    char_count=
    char_new_line="$((char_count - 1))"
    total_count=1
    current_random_number="$(echo "${random_numbers_total}" | cut -c "${total_count}")"

    # FUNCTIONS
    tile_swap() { # NOTE Arguments: "<Character to find>" "<Character replacement>" "<Colour variable/function>"
    # FIND SPECIFIC CHARACTER AND SWAP TO CHOSEN CHARACTER WITH RANDOM COLOUR TILE

        # VARIABLES
        character_search="${1}"
        character_swap="${2}"
        character_colour="${3}"
        reset="\x1b[0m"
        total_count="$((total_count + 1))"
        current_random_number="$(echo "${random_numbers_total}" | cut -c "${total_count}")"

        # CODE
        # REPLACE "${character_search}" CHARACTER WITH COLOURED "${character_swap}" CHARACTER TILE
        if [ "$(sed "${line_i}q;d" "${file}" | cut -c "${char_i}")" = "${character_search}" ]; then
            printf "%b%b%b" "${character_colour}" "$(sed "${line_i}q;d" "${file}" | cut -c "${char_i}" | sed "s/${character_search}/${character_swap}/")" "${reset}"
        fi
    }

    # CODE
    # REPEAT THROUGH NUMBER OF LINES FROM SOURCED FILE
    while [ "${line_i}" -ne "${line_count}" ]; do
        line_i="$((line_i + 1))"
        char_count="$(sed "${line_i}q;d" "${file}" | wc -c)"
        # REPEAT THROUGH NUMBER OF CHARACTERS IN THE CURRENT LINE FROM SOURCED FILE
        while [ "${char_i}" -ne "${char_count}" ]; do
            char_i="$((char_i + 1))"
            # SWAP CHARACTER AND COLOUR TILE
            character_current="$(sed "${line_i}q;d" "${file}" | cut -c "${char_i}")"
            case "${character_current}" in
                "+")
                    # SWAP "+" TO "O" WITH RANDOM COLOURED TILE
                    tile_swap "+" "O" "$(select_random_colour "${current_random_number}")"
                ;;
                "@")
                    # SWAP "@" TO "+" WITH NO COLOUR CHANGE
                    tile_swap "@" "+" ""
                ;;
                *)
                    # UNSPECIFIED CHARACTER: INSERT UNCHANGED CHARACTER TILE
                    printf "%b" "$(sed "${line_i}q;d" "${file}" | cut -c "${char_i}")"
                ;;
            esac
        done
        # INSERT NEW LINE AFTER REACHING LAST CHARACTER IN THE CURRENT LINE FROM SOURCED FILE
        if [ "${char_i}" -ge "${char_new_line}" ]; then
            char_i=0
            printf "\n"
        fi
    done
}



##### START

# CODE #

if ! initialization; then
    return 1
fi

main "${file_location}"

##### FINISH

:::

::: spoiler Drawing


            _________
           |_-_-_-_-_|
           |_________|
            )_______(
           (_________)                                                ++++++++
           |         |  Biodegrade me, Daddy!                      ++++++++++++++
           /         \   /                                       ++++++++++++++++++
          /           \ /                                       ++++++++++++++++++++
         /    0   0    \                                   No.  ++++++++++++++++++++
        /               \                                    \  ++++++  +++  +++++++
       /========0========\                                    \ ++++++++++++++++++++
      /                   \                                     ++++++++++++++++++++
     (_____________________)                                    ++++++++   +++++++++
      )___________________(                                     +++++++ +++ ++++++++
     (_____________________)                                    ++++++++++++++++++++
     |                     |                                    ++++++++++++++++++++
     |_____________________|                                    ++++++++++++++++++++
      )___________________(                                     ++++++++++++++++++++
     |_____________________|                                    ++++++++++++++++++++
      )___________________(                                     ++++++++++++++++++++
     |                     |                                    ++++++++++++++++++++
     |_____________________|                                    ++++++++++++++++++++
      )___________________(                                     ++++++++++++++++++++
     |_____________________|                                    ++++++++++++++++++++
      )___________________(                                     ++++++++++++++++++++
     |                     |                                    ++++++++++++++++++++
     |                     |                                    ++++++++++++++++++++
     |_____________________|                                    ++++++++++++++++++++
     (_____________________)                                    ++++++++++++++++++++
     |_____________________|                                     ++++++++++++++++++
     (_____________________)                                     ++++++++++++++++++
     |                     |                                     ++++++++++++++++++
     |                     |                                      ++++++++++++++++
     \_____________________/                                        |          |
      '-------------------'

:::

Art

View original on lemmy.dbzer0.com
36

A Message

::: spoiler Source Code


#!/bin/sh



# DON'T RUN RANDOM CODE
# DO RUN

# <<Al generated code. he is happy. he is fed.>>



# New Phone, Don't call me again!
increase_entropy=1
decrease_lycanthropy=yes

ohnoo=
allthefingies=
passphrase=
imsohappy=

the="\033[30m\033[41m"
quick="\033[31m\033[42m"
brown="\033[32m\033[45m"
fox="\033[33m\033[47m"
jumps="\033[34m\033[46m"
over="\033[35m\033[43m"
the_="\033[36m\033[40m"
lazy="\033[37m\033[44m"
dog="\x1b[0m"

# Why aren't you working? You must be productive!
dodiscobobulator() {
    # Redoing all your mistakes
    printf "%b" "$1" | openssl aes-256-cbc -a -A -pbkdf2 -pass pass:nopass

}
undiscobobulator() {
    # he is healthy.
    printf "%b" "$1" | openssl aes-256-cbc -a -A -d -pbkdf2 -pass pass:nopass
}

structural_integrity_tortilla() {
    # he is loved.
    passwort="$1"
    if [ -z "$1" ]; then
        printf "You did this, this is your fault.\n"
        return 1
    else
        logger -t environmental.decay "Thank you for supplying the following super secret password: $passwort"
        return 0
    fi
}

count_yo_fingies() {
    # But not yet!
    fingie1=
    fingie2=
    fingie3=
    fingie4=
    fingie5=
    fingie6=
    fingie7=
    fingie8=
    fingie9=
    fingie10=
    fingie11=
    fingie12=
    fingie13=
    fingie14=
    fingie15=
    fingie16=
    fingie17=
    fingie18=
    # Okay now!
    fingie1="$(awk 'BEGIN { srand(); print int(rand()*999999999999999999999999999999999999999999999999999999999999) }' /dev/null)"
    fingie2="$(od -An -N2 -d /dev/urandom | tr -dc '[:digit:]')"
    fingie3="$(awk -v min=10000000000000000000 -v max=99999999999999999999 'BEGIN{srand(); print int(min+rand()*(max-min+1))}')"
    fingie4="$(head -99999 /dev/urandom | cksum | cut -f1 -d " ")"
    fingie5="$(cat < /dev/urandom | tr -dc '[:digit:]' | fold -w 500 | head -n 1)"
    if the_latest_must_haves "mktemp"; then
        fingie6="$(mktemp -u XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | tr -dc '[:digit:]' && printf "\n")"
    else
        fingie6="N\A"
    fi
    if the_latest_must_haves "shuf"; then
        fingie10="$(shuf -i 1000000000000000000-9999999999999999999 -n 1)"
    else
        fingie10="N\A"
    fi
    fingie11="$(openssl rand -base64 64 | tr -dc '[:digit:]')"
    fingie12="$(awk -v min=10000 -v max=100000 'BEGIN{srand(); print int(min+rand()*(max-min+1))}')"
    if the_latest_must_haves "shuf"; then
        fingie13="$(($(($(shuf -i 10000-999999 -n 1)%10000))+2))"
    else
        fingie13="N\A"
    fi
    if the_latest_must_haves "sha1sum"; then
        fingie14="$(sha1sum "$SHELL" | tr -dc '[:digit:]')"
    else
        fingie14="N\A"
    fi
    if the_latest_must_haves "sha224sum"; then
        fingie15="$(sha224sum "$SHELL" | tr -dc '[:digit:]')"
    else
        fingie15="N\A"
    fi
    if the_latest_must_haves "sha256sum"; then
        fingie16="$(sha256sum "$SHELL" | tr -dc '[:digit:]')"
    else
        fingie16="N\A"
    fi
    if the_latest_must_haves "sha384sum"; then
        fingie17="$(sha384sum "$SHELL" | tr -dc '[:digit:]')"
    else
        fingie17="N\A"
    fi
    if the_latest_must_haves "sha512sum"; then
        fingie18="$(sha512sum "$SHELL" | tr -dc '[:digit:]')"
    else
        fingie18="N\A"
    fi
    if the_latest_must_haves "uuidgen"; then
        fingie7="$(uuidgen | tr -dc '[:digit:]' && printf "\n")"
        fingie8="$(uuidgen | base64 |  tr -dc '[:digit:]'; echo)"
        fingie9="$(uuidgen | base64 | md5sum | head -c 10 |  tr -dc '[:digit:]'; echo)"
    else
        fingie7="N/A"
        fingie8="N/A"
        fingie9="N/A"
    fi
}

the_latest_must_haves() {
if [ -z "$(command -v "$1")" ]; then
    # Please turn yourself in for immediate brain scan. Final notice.
    return 1
else
    # Thank you for consenting to upload your brain to the cloud
    return 0
fi
}

internet_fingies() {
    # Sticky
    fingie20="${ohnoo:="N/A"}"
    fingie21="${ohnoo:="N/A"}"
    fingie22="${ohnoo:="N/A"}"
    if the_latest_must_haves "curl"; then
        printf "\nCOUNTING INTERNET FINGIES (This may take an non-instantaneous amount of time)\n"
        fingie20="$(curl -s "http://www.randomnumberapi.com/api/v1.0/random?min=100&max=1000&count=5" | tr -dc '[:digit:]' && printf "\n")"
        fingie21="$(curl -s http://wttr.in/Pljevlja | tr -dc '[:digit:]' && printf "\n")"
        fingie22="$(curl -sH 'Accept: application/activity+json' https://lemmy.dbzer0.com/u/confusedpuppy | tr -dc '[:digit:]' && printf "\n")"
    fi
}

cloudchair_cum_wall_integration() {
    # Pulsating
    fingie19="${ohnoo:="N/A"}"
    if the_latest_must_haves "curl"; then
        printf "\nCUM WALL INTEGRATION (Please wait, almost there, just a little more...)\n"
        fingie19="$(curl -s https://lemmy.sdf.org/pictrs/image/d33ea38a-e984-408f-9ae1-ba061429b814.png | tr -dc '[:digit:]' | cut -b 1-100)"
    fi
}

let_me_count_yo_fingies() {
    # Touch me
    printf "\nFINGIES COUNTED:"
    printf "\n 1: %b" "${fingie1}"
    printf "\n 2: %b" "${fingie2}"
    printf "\n 3: %b" "${fingie3}"
    printf "\n 4: %b" "${fingie4}"
    printf "\n 5: %b" "${fingie5}"
    printf "\n 6: %b" "${fingie6}"
    printf "\n 7: %b" "${fingie7}"
    printf "\n 8: %b" "${fingie8}"
    printf "\n 9: %b" "${fingie9}"
    printf "\n10: %b" "${fingie10}"
    printf "\n11: %b" "${fingie11}"
    printf "\n12: %b" "${fingie12}"
    printf "\n13: %b" "${fingie13}"
    printf "\n14: %b" "${fingie14}"
    printf "\n15: %b" "${fingie15}"
    printf "\n16: %b" "${fingie16}"
    printf "\n17: %b" "${fingie17}"
    printf "\n18: %b" "${fingie18}"
    printf "\n19: %b" "${fingie19}"
    printf "\n20: %b" "${fingie20}"
    printf "\n21: %b" "${fingie21}"
    printf "\n22: %b" "${fingie22}"
}

quick_maths() {
    # he is not lonely.
    if the_latest_must_haves "shuf"; then
        sum=$(shuf -ez "$fingie1$fingie2$fingie3$fingie4$fingie5$fingie6$fingie7$fingie8$fingie9$fingie10$fingie11$fingie12$fingie13$fingie14$fingie15$fingie16$fingie17$fingie18$increase_entropy$fingie19$fingie20$fingie21$fingie22" | tr -dc '[:digit:]')
        total="$sum$sum$sum$sum$sum"
        allthefingies="${#total}"
    else
        sum="$fingie1$fingie2$fingie3$fingie4$fingie5$fingie6$fingie7$fingie8$fingie9$fingie10$fingie11$fingie12$fingie13$fingie14$fingie15$fingie16$fingie17$fingie18$increase_entropy$fingie19$fingie20$fingie21$fingie22"
        total="$(printf "%b" "$sum$sum$sum$sum$sum" | tr -dc '[:digit:]')"
        allthefingies="${#total}"
    fi
}

is_yo_maths_good() {
    # So many to lick
    printf "\n\nQUICK MATHS:\n"
    printf "\nFINGIES: %b\n" "${allthefingies}"
    printf "\nTOESIES: %b\n" "${total}"
    if [ "${allthefingies}" -lt 4000 ]; then
        printf "\nThis dangerous and life altering script requires more processing power than the potato currently in use\n\n"
        return 1
    fi
}

hypothetically_speaking() {
        printf "\n%b" "$(undiscobobulator "U2FsdGVkX19uPTg4gWR23qwvxReJvu8vHQRJ1dG1SHm8itAadvWVYvWqQCWuiih7B3xd2PgCQ8nE+nWqk3rTN/lJ9MPSojabLePfbIhwRocDZR0zj7Yy2yXJSlJxjMEf" > /dev/null)"
}

fool_moon() {
    if [ "${decrease_lycanthropy}" = "no" ]; then
        printf "\n%b" "$(undiscobobulator "U2FsdGVkX19AYhO5F8vxLKRkHEHB3N9YDPWLifEQ0zXLqUQfMVIknNZTXGlcL7qc")"
    fi
}

slop_shop() {
    # he is well rested.
    i=1
    need="${total}"
    more=
    water=
    printf "\n\n\n\n\n"
    while [ "$i" -ne 2000 ]
    do
        more=$(printf "%s" "${need}" | cut -c $i | cat)
        water=$(printf "%s" "${need}" | tail -c 2000| cut -c $i | cat)
        i=$((i + 1))
        case "${more}" in
            1)
            printf "%b%s%b" "${the}" "${passphrase}" "${dog}"
            ;;
            2)
            printf "%b%s%b" "${quick}" "${passphrase}" "${dog}"
            ;;
            3)
            printf "%b%s%b" "${brown}" "${passphrase}" "${dog}"
            ;;
            4)
            printf "%b%s%b" "${fox}" "${passphrase}" "${dog}"
            ;;
            5)
            printf "%b%s%b" "${jumps}" "${passphrase}" "${dog}"
            ;;
            6)
            printf "%b%s%b" "${over}" "${passphrase}" "${dog}"
            ;;
            7)
            printf "%b%s%b" "${the_}" "${passphrase}" "${dog}"
            ;;
            8)
            printf "%b%s%b" "${lazy}" "${passphrase}" "${dog}"
            ;;
            9)
            printf "%b" "${dog}"
            ;;
            0)
            printf "%b" "${dog}"
            ;;
        esac
        printf "%b" "${dog}"
        case "${water}" in
            1)
            printf " "
            ;;
            2)
            printf "  "
            ;;
            3)
            printf "   "
            ;;
            4)
            printf "    "
            ;;
            5)
            printf "     "
            ;;
            6)
            printf "      "
            ;;
            7)
            printf "       "
            ;;
            8)
            printf "        "
            ;;
            9)
            printf "         "
            ;;
            0)
            printf "          "
            ;;
        esac
        printf "%b" "${dog}"
    done
}


# The beginning of the end
passphrase="$(undiscobobulator "U2FsdGVkX1+vaiWVML2vn88ENfjTOzdJnAN9PhWJUkY=")"
imsohappy="$(undiscobobulator "U2FsdGVkX18DYedQo0t5RohZVgMxHLY44tvuskTp/hg3HYfmogpM5/x3sBDw6fr7")"

if ! the_latest_must_haves "openssl"; then
    printf "\nWrong turn, please turn around and reverse away from here\n\n"
    return 1
fi
if ! structural_integrity_tortilla "${imsohappy}"; then
    return 1
fi
count_yo_fingies
internet_fingies
cloudchair_cum_wall_integration
let_me_count_yo_fingies
quick_maths
if ! is_yo_maths_good; then
    return 1
fi
hypothetically_speaking
slop_shop
fool_moon
printf "%b\n" "${dog}"

:::

View original on lemmy.dbzer0.com
63
bun_alert_system·Bun Alert Systembyconfusedpuppy

Stealthy Bun

I have a small garden where I there random seeds in the ground and let the plants have a free for all. The bunnies have made a little hiding spot where it has sun for the majority of the day, but also provides shade and cover. I can easily see where they are because the undergrowth is always trampled.

I try to check if they are hiding there but sometimes I forget when I'm distracted by the flowers. The bunnies don't seem to be worried about me and keep on chilling even though I'm only a couple steps away from them.

I'm happy they found a nice and cozy area in my garden. Can't wait to harvest my bunny crops before it gets too cold :)

View original on lemmy.dbzer0.com
56

Can't access exposed rootful podman container from outside of host device

As of right now, I currently have a working Docker container for Caddy which can successfully get TLS certs and I am able to access my own test site with an external web browser.

What I want to do use the same files (Dockerfile, docker-compose.yml and Caddyfile) to do the same with Podman Compose. When I run podman compose up -d I am able to build the Caddy container and it will also successfully get it's own TLS cert.

::: spoiler docker-compose.yml

services:
  caddy:
    container_name: caddy
    build: .
    restart: always
    ports:
      - 80:80
      - 5050:443
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile
      - caddy_data:/data
      - caddy_config:/config
      - /home/sxc-pi/shared/:/srv:Z
    networks:
      - reverse_proxy

volumes:
  caddy_data:
  caddy_config:

networks:
  reverse_proxy:
    external: true

:::

While on the same device, I can use curl localhost:5050 and get the message Client sent an HTTP request to an HTTPS server. which is the same result as if I were using Docker. If I try to access my site through my domain name or local network ip address from an external device, the connection times out.

I didn't make any changes to my firewall or router's port forwarding because I expect Rootful Podman Compose to work similar to Docker.

I checked iptables and below are the differences between using Docker and Podman but I don't really know networking enough to understand what it's really saying

::: spoiler iptables differences

sxc-pi:/srv/caddy$ diff ~/iptables-docker ~/iptables-podman 
--- /home/sxc-pi/iptables-docker
+++ /home/sxc-pi/iptables-podman
@@ -31,8 +31,6 @@
 
 Chain DOCKER (2 references)
 target     prot opt source               destination         
-ACCEPT     tcp  --  anywhere             172.18.0.2           tcp dpt:https
-ACCEPT     tcp  --  anywhere             172.18.0.2           tcp dpt:http
 DROP       all  --  anywhere             anywhere            
 DROP       all  --  anywhere             anywhere            
 
@@ -70,15 +68,20 @@
 Chain NETAVARK_FORWARD (1 references)
 target     prot opt source               destination         
 DROP       all  --  anywhere             anywhere             ctstate INVALID
+ACCEPT     all  --  anywhere             10.89.0.0/24         ctstate RELATED,ESTABLISHED
+ACCEPT     all  --  10.89.0.0/24         anywhere            
 
 Chain NETAVARK_INPUT (1 references)
 target     prot opt source               destination         
+ACCEPT     udp  --  10.89.0.0/24         anywhere             udp dpt:domain
+ACCEPT     tcp  --  10.89.0.0/24         anywhere             tcp dpt:domain
 
 Chain NETAVARK_ISOLATION_2 (1 references)
 target     prot opt source               destination         
 
 Chain NETAVARK_ISOLATION_3 (0 references)
 target     prot opt source               destination         
+DROP       all  --  anywhere             anywhere            
 NETAVARK_ISOLATION_2  all  --  anywhere             anywhere            
 
 Chain ufw-after-forward (1 references)

:::

I've also rebooted after starting the Podman containers incase there were any iptables issues but that still didn't help.

I've searched what I can but haven't gotten anything to work or get me closer to finding an answer.

I'm hoping to use Rootless Podman if I can figure this out, if not I have Docker as a fall back plan.

Any help or insight would be appreciated.

View original on lemmy.dbzer0.com
21

Caddy + DeSEC.io + DNS Challenge [Solved]

For a couple weeks I've been struggling to get TLS over Caddy with DNS challenges. My ISP blocks incoming data on ports 80/443 and I was looking to use an uncommon port (5050) for my personal needs.

I've followed the instructions here and I've made sure to use the proper DeSEC.io module in my docker build.

When I start my docker container and check the logs, I get an error that says the challenge failed because of an incorrect TXT record. However when I check DeSEC.io's website, the TXT record that was created matches the Caddy log error message and even shows that the TXT record has been last touched "less than a minute ago."

I've tried minimizing my Caddyfile to the bare minimum and I still can't seem to get TLS working.

::: spoiler Dockerfile

FROM caddy:2.10.0-builder AS builder

RUN xcaddy build \
    --with github.com/caddy-dns/desec
FROM caddy:2.10.0

COPY --from=builder /usr/bin/caddy /usr/bin/caddy

:::

::: spoiler docker-compose.yml

services:
  caddy:
    container_name: caddy
    build: .
    restart: always
    ports:
      - 80:80
      - 5050:443
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile
      - caddy_data:/data
      - caddy_config:/config
      - /home/sxc-pi/shared/:/srv:Z
    networks:
      - reverse_proxy

volumes:
  caddy_data:
  caddy_config:

networks:
  reverse_proxy:
    external: true

:::

::: spoiler Caddyfile

{
        acme_dns desec {
                token "<DeSEC.io Token Number>"
        }
}

files.samplesite.com {
        root * /srv
        file_server {
                hide misc
                browse
        }
}

:::

At this point I do not know what else I can try to get TLS working with Caddy. If I can't get this to work, I can use Nginx Proxy Manager as a tried and tested backup plan, although I prefer to use something that is terminal based because I don't want to use the Web UI that NPM uses.

Any insight or help would be greatly appreciated. I'm also not looking to use any tunnel services at the moment. I'd like to figure this way out so I have a fall back plan if I decide to use a tunnel in the future.

View original on lemmy.dbzer0.com
27
greenspace·Nature and Gardeningbyconfusedpuppy

The babies grew up too fast

Woke up this morning to an empty nest. The babies were walking around the deck while both parents were out.

About an hour later both parents came back. The babies were hiding behind a pot so I moved it out of the way and the one parent immediately came down and sat with them for about 10 minutes.

After a bit the parent called out and fed both the kids. Not long after that they all flew off into the big tree in our backyard.

Sad to see them go but I hope they stay safe out there and come back again next year :)

View original on lemmy.dbzer0.com
1

Why do mourning doves vibrate?

Lately I've noticed the mourning dove nesting in our planter has been vibrating a lot lately. It's throat visibly and silently vibrates. I've even noticed it's tail has been vibrating as well and it's causing the plants in the planter to shake too.

Currently there's two babies in the nest with it so I assume it's some form of contentment like a cat purring?

When I first go outside, it's usually like an unblinking statue. Once I'm sitting down and eating or playing music at a reasonable volume, it's quite animated, curious, blinking and vibrating constantly.

I also thought maybe it has something to do with producing crop milk since this all started sometime around when the babies hatched but I can't find anything when I search for more information.

View original on lemmy.dbzer0.com
10