Skip to content

Instantly share code, notes, and snippets.

@marshki
marshki / OpenConnect_install.sh
Last active August 9, 2023 14:58
To access NYU's LAN via VPN on Debian, Fedora, or Ubuntu (Gnome), you need one or more packages. This Bash snippet installs them.
#!/usr/bin/env bash
#
# OpenConnect_install
#
# Install pkgs. needed to use OpenConnect (https://www.infradead.org/openconnect/) client in:
# Debian GNU/Linux, Fedora, or Ubuntu (GNOME desktop).
#
# Author: M. Krinitz <mjk235 [at] nyu [dot] edu>
# Date: 2023.09.08
# License: MIT
@marshki
marshki / faux_tree.sh
Last active August 10, 2023 17:08
Partially mimic the `tree` command via Bash in macOS, Synology Disk Station Manager (DSM), et al.
#!/usr/bin/env bash
#
# Faux "tree" function in macOS, Synology Disk Station Manager (DSM), et. al.
# Comparable in output to Steve Baker's "tree" utility:
# http://mama.indstate.edu/users/ice/tree/
#
# Add function to: /Users/foo/.profile, or: .bash_profile,
# then refresh the profile with: source .profile or: source .bash_profile
#
# Inspired by this thread: https://superuser.com/questions/359723/mac-os-x-equivalent-of-the-ubuntu-tree-command
@marshki
marshki / bash_simple_menu.sh
Last active January 7, 2021 00:47
Bash menu template.
#!/usr/bin/env bash
#
# Simple menu
# Pause prompt.
# Suspend processing of script; display message prompting user to press [Enter] key to continue.
# $1-> Message (optional)
function pause() {
local message="$@"
@marshki
marshki / untar_progress_bar.sh
Last active January 6, 2021 18:14
"Dialog" progress bar to monitor the extraction of a "tar" archive.
#!/usr/bin/env bash
#
# Untar progress bar
script=`basename "$0"`
program="Tar & Feather"
# Install pre-reqs:
sudo apt-get --yes install dialog pv
@marshki
marshki / bash_simple_loop.sh
Last active February 27, 2024 23:43
Bash loop for the forgetful.
#!/usr/bin/env bash
#
# Simple loop in Bash
while : ; do
printf "%s\n" "Do this!"
printf "%s\n" "Do that!"
printf "%s\n" "And this, too!"
read -rp "Do you wish to continue (yes/no)?: " reply
@marshki
marshki / generate_stuff.sh
Last active October 24, 2020 15:35
Create (small) dummy data in Bash.
#!/usr/bin/env bash
#
# generate_stuff
#
# Create dummy data. Used as a sandbox for testing:
# https://gist.github.com/marshki/693ad8682cd14cc11f8ff4babeb47ca7
#
# Author: M. Krinitz <mjk235 [at] nyu [dot] edu>
# Date: 2020.03.01
# License: MIT
@marshki
marshki / find_duplicates.sh
Last active April 28, 2020 21:43
Locate duplicate data and mv (rather than remove) in Bash.
#!/usr/bin/env bash
#
# find_duplicates
#
# Identify and move duplicate data to: /tmp for review.
#
# Author: M. Krinitz <mjk235 [at] nyu [dot] edu>
# Date: 2020.02.20
# License: MIT
@marshki
marshki / add_matlab_launcher.sh
Last active July 16, 2023 18:01
Add MATLAB icon launcher in Ubuntu.
#!/usr/bin/env bash
#
# add_matlab_launcher
#
# Author: M. Krinitz <mjk235 [at] nyu [dot] edu>
#
# Add a MATLAB icon launcher in Ubuntu.
# Date: 2023.07.14
# License: MIT
@marshki
marshki / sendmail_setup.md
Last active December 19, 2023 19:49
Setup Sendmail in GNU/Linux.

Setup Sendmail in GNU/Linux 📫

Scope: Set up a general-purpose internetwork routing facility that supports Simple Mail Transfer Protocol (SMTP).

Dependencies

Install these packages first, per your operating system (OS):

CentOS, Fedora Debian, Ubuntu
dnf install apt-get install
sendmail-cf sendmail-cf
@marshki
marshki / mirror_mirror.sh
Last active December 3, 2021 20:35
One-way Rsync mirror of data from source to destination. Run as a crontab.
#!/usr/bin/env bash
#
# mirror_mirror
#
# One-way Rsync mirror of data from source to destination.
#
# Author: M. Krinitz <mjk235 [at] nyu [dot] edu>
# Date: 2020.04.20
# License: MIT
#