Skip to content

Instantly share code, notes, and snippets.

@spinofdoom
spinofdoom / archey
Last active February 7, 2022 20:56
A tweaked clone of obihann's macOS implementation of archey
#!/bin/bash
# A tweaked clone of obihann's macOS implementation
# of archey (https://github.com/obihann/archey-osx/).
# test to see if bash supports arrays
arraytest[0]='test' || (echo 'Error: Arrays are not supported in this version of
bash.' && exit 2)
# Detect the packager.
@spinofdoom
spinofdoom / update_all.sh
Created February 6, 2022 02:12
update all apps on macOS using homebrew and mas
#!/bin/bash
brew update
brew upgrade
brew cleanup -s
rm -rf "$(brew --cache)"
brew doctor
mas upgrade
@spinofdoom
spinofdoom / efficiency.sh
Last active February 6, 2022 02:36
script for unbound DNS - check total cache hits/misses and ratio
#!/bin/bash
MISSES=$(unbound-control stats_noreset | grep total.num.cachemiss | grep -Eo '[0-9]{1,8}')
HITS=$(unbound-control stats_noreset | grep total.num.cachehits | grep -Eo '[0-9]{1,8}')
PERCENT=$(echo "scale=4; (($MISSES / ($MISSES + $HITS) * 100))" | bc | awk ' sub("\\.*0+$","") ')
echo "There are $MISSES cache misses and $HITS cache hits for a miss rate of $PERCENT%."
echo
@spinofdoom
spinofdoom / dig.sh
Created January 15, 2021 01:26
batch dig script for unbound
#!/bin/bash
# A dumbed-down version of dig-dug by crunchprank, sans csv logging.
# (A mass domain DiG script.)
# Usage: sudo bash ./dig.sh domains
while IFS= read -r domain
do
@spinofdoom
spinofdoom / fresh_macos.sh
Last active October 12, 2022 18:23
installs mas, homebrew/cask & apps
#!/bin/bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" # Install
# Homebrew
brew install cask # Install Homebrew-Cask
brew install mas # and mas via Homebrew.
brew update
brew install speedtest-cli
brew install bash # Install Command Line Tools
@spinofdoom
spinofdoom / headlines.py
Last active June 19, 2018 00:55
Headlines [Python 3.6+] - grabs top headlines from NYT, Guardian (U.S.), AJ: English, and WaPo, and displays them as links in a plain HTML page
from datetime import date
from webbrowser import open_new
from os.path import join as pjoin, expanduser
import requests
home = expanduser('~')
today = str(date.today())
newsApiKey = '' # Save your keys here.
guardianApiKey = '' # Free API keys can be generated from
# News API (https://newsapi.org/register) and the
@spinofdoom
spinofdoom / passwordgenerator.py
Last active February 7, 2022 22:20
Password Generator
from secrets import SystemRandom
pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.@?!#$%&~-_'
print("Password Generator!")
while True:
try:
n = input("Enter the number of characters you want your password to be: ")
r = SystemRandom()
x, y = r.choice(pool), []