Skip to content

Instantly share code, notes, and snippets.

View dimo414's full-sized avatar
🦀
Playing with Rust

Michael Diamond dimo414

🦀
Playing with Rust
View GitHub Profile
@dimo414
dimo414 / _README.md
Last active November 28, 2022 07:25
Bash array expansion patterns for use with -u

Expanding Bash arrays safely with set -u

Prior to Bash 4.4 set -u treated empty arrays as "unset", and terminates the process. There are a number of possible workarounds using array parameter expansion, however almost all of them fail in certain Bash versions.

This gist is a supplement to this StackOverflow post.

@timvisee
timvisee / SUBREDDIT_LIST.md
Last active December 22, 2023 02:13
Get a list of subreddits you're subscribed to on reddit. https://timvisee.com/blog/list-export-your-subreddits/

As posted on: https://timvisee.com/blog/list-export-your-subreddits/

Get a list of your subreddits

To obtain a list of your subreddits, do the following:

  • First make sure you're logged in on reddit, on a desktop browser.
  • Then visit reddit.com/subreddits.
  • Then put the following snippet in your browsers address bar, and press Enter.
    Make sure javascript: is included at the beginning, your browser might remove it while copy-pasting for security reasons:
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active April 25, 2024 15:17
Hyperlinks in Terminal Emulators
@RichardBronosky
RichardBronosky / tputdemo.sh
Created October 21, 2013 20:40
I created this gist to demo tput for this stackexchange answer: http://unix.stackexchange.com/questions/16429/#16433
#!/usr/bin/env bash
# tputdemo.sh
echo -e "\n$(tput bold) reg dim bld und tput-command$(tput sgr0)"
for i in $(seq 0 15); do
for k in sgr0 dim bold smul; do
echo -n " $(tput $k)$(tput setaf $i)Text$(tput sgr0)"
done
echo " \$(tput setaf $i)"
done
@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active April 2, 2024 15:59
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1