Skip to content

Instantly share code, notes, and snippets.

View jacksonporter's full-sized avatar

JP (Jackson Porter) jacksonporter

  • Orem, UT
  • 11:32 (UTC -07:00)
View GitHub Profile
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@jacksonporter
jacksonporter / remove_office_from_macos.sh
Last active November 18, 2023 18:39
Remove Office from macOS
#!/usr/bin/env bash
set -e
LIB_CONTAINERS_DIR="${HOME}/Library/Containers"
SUB_LIB_CONTAINERS=("Microsoft Error Reporting" "Microsoft Excel" "com.microsoft.netlib.shipassertprocess" "com.microsoft.Office365ServiceV2" "Microsoft Outlook" "Microsoft PowerPoint" "com.microsoft.RMS-XPCService" "Microsoft Word" " Microsoft OneNote")
LIB_GROUP_CONTAINERS_DIR="${HOME}/Library/Group Containers"
SUB_LIB_GROUP_CONTAINERS=("UBF8T346G9.ms" "UBF8T346G9.Office" "UBF8T346G9.OfficeOsfWebHost")
function main() {
@jacksonporter
jacksonporter / keybase.md
Created December 18, 2020 15:34
keybase.md

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@jacksonporter
jacksonporter / gist:bd1f63355eb6c85732f51dec2e7484bc
Created August 14, 2020 22:46 — forked from xxxVxxx/gist:9648264fd6f41bbb1f65
boto3 aws find all IAM accesskeys details for the account
#!/usr/bin/env python
import boto3
import datetime
import json
ACCESS_KEY_LAST_USED_KEY = "AccessKeyLastUsed"
KEY = "LastUsedDate"
USERS_KEY = "users"
NUMBER_OF_KEYS_KEY = "number_of_keys"
@jacksonporter
jacksonporter / all_pdf_files_to_combined_pdf.sh
Last active May 17, 2020 23:32
Wrapper over the gs operation to stitch PDFs. Save as a script on your local, or slightly modify and you can throw it in a function.
#!/usr/bin/env bash
set -e
if [[ -z "$(which gs)" ]]; then
printf 'Ghostscript (gs) is not installed, please install it to continue.\n\tExample: `brew install gs`\n'
exit 1
fi
usage="Usage:\n\tall_pdf_files_to_combined_pdf RESULTING_PDF_FILE_NAME pdf1 pdf2 ...\n"
@jacksonporter
jacksonporter / remove_user.sh
Last active March 21, 2020 01:06
Removes a user and their home directory as well as deleting any mention of their name in the sudoers file
#!/usr/bin/env bash
set -e
eval "$(curl -fsSL https://gist.github.com/jacksonporter/791145218e977ef9165abd9fdf8fbfd4/raw)" # obtains my common bash utilies script and "sources" it
check_if_root
read -p "Enter a username: " USERNAME
if [ "${USERNAME}" == "" ]; then
print_error "You did not enter a user name."
@jacksonporter
jacksonporter / setup_basic_ssh_entry.sh
Last active March 20, 2020 23:38
Sets up basic entry for the current user via SSH
#!/usr/bin/env bash
# Re-written by Jackson Porter, part of fork: https://gist.github.com/jacksonporter/34e59e05c1df7b7bfc7e29ae9fef8436
# SSH Key generation/new user reference: https://www.digitalocean.com/community/questions/ubuntu-16-04-creating-new-user-and-adding-ssh-keys
set -e
eval "$(curl -fsSL https://gist.github.com/jacksonporter/791145218e977ef9165abd9fdf8fbfd4/raw)" # obtains my common bash utilies script and "sources" it
print_warning "generating .ssh dir in $(pwd) as user ${GREEN_COLOR}$(whoami)${YELLOW_COLOR}."
mkdir .ssh
@jacksonporter
jacksonporter / bash_script_utilities.sh
Last active March 21, 2020 00:47
A set of common bash script variables and functions to use within other bash scripts
#!/usr/bin/env bash
# Written by Jackson Porter
NO_COLOR='\033[0m'
GREEN_COLOR='\033[0;32m'
RED_COLOR='\033[0;31m'
YELLOW_COLOR='\033[1;33m'
function check_if_root {
if [[ ${EUID} -ne 0 ]]; then
@jacksonporter
jacksonporter / add_new_user_zsh_ssh.sh
Last active March 21, 2020 00:57 — forked from zuckercode/gist:3720747
add new user with zsh as default shell, setup of basic SSH keys
#!/usr/bin/env bash
# Re-written by Jackson Porter
# Forked from: https://gist.github.com/zuckercode/3720747
# SSH Key generation/new user reference: https://www.digitalocean.com/community/questions/ubuntu-16-04-creating-new-user-and-adding-ssh-keys
# Color Code obtained from: https://gist.github.com/jacksonporter/73f8e9343e61e280cb178aa6ef4ec64e
set -e
eval "$(curl -fsSL https://gist.github.com/jacksonporter/791145218e977ef9165abd9fdf8fbfd4/raw)" # obtains my common bash utilies script and "sources" it