remove some legacy config files

This commit is contained in:
Noah Masur 2022-07-26 00:09:25 -04:00
parent 4e8546728e
commit 7edfcd9743
26 changed files with 8 additions and 715 deletions

View File

@ -1,16 +0,0 @@
FROM alpine:latest
COPY requirements.txt /
RUN apk update && \
apk add \
openssh \
python \
py-pip \
&& \
pip install -r requirements.txt
COPY connect_cloud.sh /
COPY connect_cloud.py /
ENTRYPOINT ["/connect_cloud.sh"]

View File

@ -1,85 +0,0 @@
#!/usr/bin/env python
"""Connect to Cloud instances"""
import os
import sys
import argparse
import boto3
# Initiate the parser
parser = argparse.ArgumentParser("Type the name of the connection you want")
parser.add_argument('profile', metavar='P', nargs='?',
help='an account to use')
parser.add_argument('environment', metavar='E', nargs='?',
help='an environment to specify')
args = parser.parse_args()
# Get AWS credentials profile
profile_map = {
'gs' : {
'profile': 'ghoststory',
'prod': 'id_rsa_gstory_prod.pem',
'dev': 'id_rsa_gstory_prod.pem',
'username': 'centos',
},
'di' : {
'profile': 't2indies',
'prod': 'disintegration-prod.pem',
'dev': 'disintegration-dev.pem',
'username': 'centos',
},
'pd' : {
'profile': 't2indies',
'prod': 't2indies-prod.pem',
'dev': 't2indies-dev.pem',
'username': 'centos',
},
'corp' : {
'profile': 't2corp',
'prod': 'take2games-corp.pem',
'dev': 'take2games-corp.pem',
'username': 'ec2-user',
},
'ksp' : {
'profile': 'kerbal',
'prod': 'kerbal_prod_key.pem',
'dev': 'kerbal_dev_key.pem',
'username': 'centos',
},
}
profile_dict = profile_map.get(args.profile)
profile = profile_dict['profile']
# Connect to AWS
session = boto3.Session(profile_name=profile)
client = session.client('ec2', verify=False)
response = client.describe_instances()
print(len(response['Reservations']), "total instances\n")
matched_instances = []
for instance_wrapper in response['Reservations']:
instance = instance_wrapper['Instances'][0]
is_matched_env = False
is_matched_role = False
for tag in instance.get('Tags', []):
if tag['Key'] == "site_env" and args.environment in tag['Value']:
is_matched_env = True
if tag['Key'] == "role" and tag['Value'] == 'host':
is_matched_role = True
if tag['Key'] == "Name":
instance['Name'] = tag['Value']
if is_matched_env and is_matched_role:
matched_instances.append(instance)
for instance in matched_instances:
print(instance['Name'])
print(instance['PublicIpAddress'])
print("")
with open("aws_connect", 'w') as outfile:
outfile.write("ssh-keyscan {} >> ~/.ssh/known_hosts\n".format(matched_instances[0]['PublicIpAddress']))
outfile.write("ssh -i ~/.ssh/{} {}@{}".format(profile_dict[args.environment], profile_dict['username'], matched_instances[0]['PublicIpAddress']))
os.chmod("aws_connect", 0o755)

View File

@ -1,5 +0,0 @@
#!/bin/sh
python connect_cloud.py "$@"
/aws_connect

View File

@ -1,8 +0,0 @@
boto3==1.9.239
botocore==1.12.239
docutils==0.15.2
jmespath==0.9.4
python-dateutil==2.8.0
s3transfer==0.2.1
six==1.12.0
urllib3==1.26.5

View File

@ -1,37 +0,0 @@
#!/bin/sh
case $1 in
t2) organization="take-two" ;;
d2c) organization="take-two-t2gp" ;;
t2gp) organization="take-two-t2gp" ;;
pd) organization="private-division" ;;
dots) organization="playdots" ;;
*) organization="nmasur" ;;
esac
selected=$(gh repo list "$organization" \
--limit 50 \
--no-archived \
--json=name,description,isPrivate,updatedAt,primaryLanguage \
| jq -r '.[] | .name + "," + if .description == "" then "-" else .description |= gsub(","; " ") | .description end + "," + .updatedAt + "," + .primaryLanguage.name' \
| (echo "REPO,DESCRIPTION,UPDATED,LANGUAGE"; cat -) \
| column -s , -t \
| fzf \
--header-lines=1 \
--layout=reverse \
--bind "ctrl-o:execute:gh repo view -w ${organization}/{1}" \
--bind "shift-up:preview-half-page-up" \
--bind "shift-down:preview-half-page-down" \
--preview "GH_FORCE_TTY=49% gh repo view ${organization}/{1} | glow -" \
--preview-window up
)
[ -n "${selected}" ] && {
directory="$HOME/dev/work"
if [ $organization = "nmasur" ]; then directory="$HOME/dev/personal"; fi
repo=$(echo "${selected}" | awk '{print $1}')
repo_full="${organization}/${repo}"
if [ ! -d "${directory}/${repo}" ]; then
gh repo clone "$repo_full" "${directory}/${repo}"
fi
echo "${directory}/${repo}"
}

View File

@ -1,6 +1,13 @@
#!/bin/sh #!/bin/sh
kubectl -n kube-system get secret $(kubectl -n kube-system get secret | grep dashboard-admin | awk '{print $1}') -o json | jq -j --raw-output '.data.token' | base64 --decode | pbcopy kubectl -n kube-system get secret "$(
kubectl -n kube-system get secret |
grep dashboard-admin |
awk '{print $1}'
)" -o json |
jq -j --raw-output '.data.token' |
base64 --decode |
pbcopy
open http://localhost:8001/api/v1/namespaces/default/services/https:kubernetes-dashboard:https/proxy/#!/login open http://localhost:8001/api/v1/namespaces/default/services/https:kubernetes-dashboard:https/proxy/#!/login

View File

@ -1,25 +0,0 @@
#!/usr/bin/env bash
# Credit: https://github.com/junegunn/fzf/blob/master/ADVANCED.md
# Requires bash.
# 1. Search for text in files using Ripgrep
# 2. Interactively narrow down the list using fzf
# 3. Open the file in Vim
IFS=: read -ra selected < <(
rg \
--color=always \
--line-number \
--no-heading \
--smart-case \
--iglob !/Library/** \
--iglob !/System/** \
--iglob "!Users/$HOME/Library/*" \
"${*:-}" |
fzf --ansi \
--color "hl:-1:underline,hl+:-1:underline:reverse" \
--delimiter : \
--preview 'bat --color=always {1} --highlight-line {2}' \
--preview-window 'up,60%,border-bottom,+{2}+3/3,~3'
)
[ -n "${selected[0]}" ] && nvim "${selected[0]}" "+${selected[1]}"

View File

@ -1,5 +0,0 @@
#!/bin/sh
bucket="$1"
access="$2"
uplink ls ${access:+--access "$access"} "sj://$bucket/" | awk '{print $NF}' | xargs -I {} uplink rm ${access:+--access "$access"} "sj://$bucket/{}"

View File

@ -1,16 +0,0 @@
#!/bin/sh
CACHE_FILE="$HOME/.cache/weather_cache"
if [ "$1" = "clear" ]; then
rm -f "$CACHE_FILE"
fi
CACHE_TIME="$(stat -f %m "$CACHE_FILE" 2>/dev/null)"
NOW_TIME=$(date +%s)
TIME_PASSED=$((NOW_TIME-CACHE_TIME))
if [ "$TIME_PASSED" -gt "1200" ]
then
curl -m 2 -s "wttr.in/$WEATHER_CITY?format=%c%t" > "$CACHE_FILE"
fi
cat "$CACHE_FILE"

View File

@ -1,93 +0,0 @@
#!/bin/bash
# List brews
brew list --formula
# List dependencies
brew list -1 | while read -r cask; do
echo -ne "\x1B[1;34m $cask \x1B[0m"
brew uses "$cask" --installed | awk '{printf(" %s ", $0)}'
echo ""
done
# Uninstall brews
brew remove --force "$(brew list --formula)"
brew remove --force sd
brew remove --force zoxide
brew remove --force bat
brew remove --force fzf
brew remove --force tealdeer
brew remove --force glow
brew remove --force dos2unix
brew remove --force tree
brew remove --force wget
brew remove --force telnet
brew remove --force prettyping
brew remove --force httpie
brew remove --force gpg
brew remove --force qrencode
brew remove --force mpv
brew remove --force youtube-dl
brew remove --force pandoc
brew remove --force saulpw/vd/visidata
brew remove --force mdp
brew remove --force ansible
brew remove --force terraform
brew remove --force packer
brew remove --force awscli
brew remove --force kubectl
brew remove --force k9s
brew remove --force nmasur/repo/drips
brew remove --force hashicorp/tap/terraform-ls
brew remove --force tflint
brew remove --force noti
brew remove --force awslogs
brew remove --force shellcheck
brew remove --force shfmt
brew remove --force stylua
brew remove --force python
brew remove --force ipython
brew remove --force poetry
brew remove --force ruby
brew remove --force node
brew remove --force jq
brew remove --force gh
brew remove --force direnv
brew remove --force git
brew remove --force ripgrep
brew remove --force fd
brew remove --force neovim
brew remove --force exa
brew remove --force starship
brew remove --force tmux
brew remove --force fish
# brew remove --force trash
# Uninstall casks
brew remove --force keybase
brew remove --force discord
brew remove --force obsidian
brew remove --force dropbox
brew remove --force 1password
brew remove --force firefox
brew remove --force font-fira-mono-nerd-font
brew remove --force alacritty
# brew remove --force scroll-reverser
# brew remove --force meetingbar
# brew remove --force gitify
# brew remove --force hammerspoon
# brew remove --force logitech-g-hub
# Uninstall homebrew
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
# Install Nix
sh -c "$(curl -L https://nixos.org/nix/install)"
# Install nix-darwin
nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer
./result/bin/darwin-installer
# Use with flake (requires installing first)
darwin-rebuild switch --flake .
darwin-rebuild switch --flake .#macbook # not sure if required

View File

@ -1,38 +0,0 @@
tap "homebrew/cask"
# Core Applications
cask "alacritty" # Terminal
cask "firefox" # Browser
#cask "slack" # Chat
#cask "zoomus" # Video conference
cask "1password" # Passwords
cask "dropbox" # File sync
#cask "docker" # Containers
# Helpful Applications
cask "obsidian" # Notes
# Auxiliary Tools
cask "scroll-reverser" # Mouse vs. trackpad
cask "meetingbar" # Scheduling
cask "gitify" # GitHub notifications
# cask "basictex" # Small LaTeX distribution
cask "hammerspoon"
tap "homebrew/cask-drivers"
cask "logitech-g-hub" # Hardware drivers
# Fonts
tap "homebrew/cask-fonts"
cask "font-fira-mono-nerd-font"
# Personal
cask "keybase" # Encryption
cask "discord" # Chat
#cask "steam" # Games
#cask "epic-games" # Games
#cask "calibre" # E-Books
#cask "signal" # Messaging
# Maybe
#cask "jira-client" # Project Management

View File

@ -1,17 +0,0 @@
# Core Packages
brew "fish" # Shell
brew "neovim" # Editor
brew "tmux" # Terminal panes and windows
brew "starship" # Shell prompt
brew "git" # Latest git
brew "ripgrep" # Faster, better grep
brew "fd" # Faster, better find
brew "sd" # Faster, better sed
brew "zoxide" # Faster, better autojump
brew "exa" # Better ls
brew "bat" # Better cat
brew "fzf" # Fuzzy finder
brew "tealdeer" # Mini man page
brew "direnv" # Environment variables
brew "glow" # Markdown previews

View File

@ -1,14 +0,0 @@
# DevOps Packages
tap "nmasur/repo"
tap "hashicorp/tap"
brew "ansible" # Deploy to local server
brew "terraform" # Deploy cloud infra
brew "packer" # Build deployment images
brew "awscli" # AWS API tools
brew "kubectl" # Kubernetes CLI
brew "k9s" # Kubernetes TUI
brew "nmasur/repo/drips" # Retrieve AWS IPs
brew "hashicorp/tap/terraform-ls"
brew "tflint"

View File

@ -1,8 +0,0 @@
# Fun / Unnecessary Packages
#tap "nmasur/repo"
#tap "tarkah/tickrs"
#brew "ffmpeg" # Convert videos
#brew "nmasur/repo/bee" # Cheat on NYTimes Spelling Bee
#brew "tarkah/tickrs/tickrs" # Interactive stock tickers

View File

@ -1,17 +0,0 @@
# Still Learning Tools
tap "superfly/tap"
tap "nmasur/repo"
tap "cjbassi/ytop"
#brew "superfly/tap/flyctl" # Fly.io CLI
#brew "ghc" # Haskell
#brew "xsv" # CSV manipulation
#brew "gron" # JSON grep
#brew "nushell" # Data manipulation shell
#brew "tectonic" # Minimal LaTeX compiler
brew "noti" # Create system notifications
#brew "b2-tools" # BackBlaze B2 storage
#brew "cjbassi/ytop/ytop" # Fancy system performance
#brew "nmasur/repo/update-ssh-config" # Update .ssh/config
brew "awslogs" # View AWS log streams

View File

@ -1,10 +0,0 @@
# Programming Packages
brew "shellcheck" # Lint for bash
brew "shfmt" # Formatter for bash
brew "stylua" # Formatter for lua
brew "python" # Latest version of Python
brew "ipython" # Better interactive Python shell
brew "poetry" # Project-based Python dependencies
brew "ruby" # Newer than default ruby
brew "node" # NodeJS

View File

@ -1,20 +0,0 @@
# Utility Packages
tap "saulpw/vd"
brew "jq" # JSON manipulation
brew "dos2unix" # File conversion
brew "tree" # Display directory trees
brew "trash" # Delete to trash
brew "wget" # Not quite curl
brew "telnet" # Check networking
brew "prettyping" # Better ping
brew "httpie" # Better curl
brew "gpg" # Encryption
brew "qrencode" # Make a QR code
brew "mpv" # Video player
brew "youtube-dl" # Download YouTube videos
brew "gh" # GitHub commands
brew "pandoc" # Document converter
brew "saulpw/vd/visidata" # Spreadsheet manipulation
brew "mdp" # Terminal slideshows

View File

@ -1,2 +0,0 @@
# Run backup of mail folder, requires rclone (and uplink, with proper setup)
@hourly root rclone sync /home/noah/Mail/ mail-backup:mail/

View File

@ -1,17 +0,0 @@
#!/bin/sh
# First Uplink
curl -L https://github.com/storj/storj/releases/latest/download/uplink_linux_amd64.zip -o uplink_linux_amd64.zip
if ! (which unzip > /dev/null)
then
apt install -y unzip
fi
unzip -o uplink_linux_amd64.zip
rm uplink_linux_amd64.zip
chmod 755 uplink
sudo mv uplink /usr/local/bin/uplink
# Then rclone
curl https://rclone.org/install.sh | sudo bash
echo "\n\nNow setup rclone with: rclone config\n"

View File

@ -1,79 +0,0 @@
#!/bin/sh
DOTS=$(dirname "$0")/..
cd "$DOTS" || (echo "Directory not found: $DOTS"; exit 1)
DOTS="$PWD"
install_xcode() {
if [ "$(uname)" = "Darwin" ]
then
if ! (xcode-select --version > /dev/null 2>&1)
then
xcode-select --install
fi
echo "xcode ✓"
fi
}
install_homebrew() {
if ! (which /usr/local/bin/brew > /dev/null)
then
printf "homebrew ✕\n\n"
printf "\ninstalling homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
echo ""
fi
echo "homebrew ✓"
}
install_brews() {
brewfile=$DOTS/homebrew/core.Brewfile
if ! (/usr/local/bin/brew bundle check --file "$brewfile" > /dev/null)
then
/usr/local/bin/brew bundle --file "$brewfile"
fi
echo "brews installed ✓"
}
use_fish_shell() {
if ! (which fish > /dev/null)
then
echo "Install fish before continuing"
echo "You can do: brew install fish"
echo "Or add fish to homebrew/Brewfile and rerun"
exit 1
fi
FISH_SHELL=$(which fish)
if ! (grep "$FISH_SHELL" /etc/shells > /dev/null)
then
echo "Modifying /etc/shells"
echo "Requires sudo password"
echo "$FISH_SHELL" | sudo tee -a /etc/shells
fi
if ! (echo "$SHELL" | grep fish > /dev/null)
then
echo "Changing default shell to fish"
echo "Requires sudo password"
sudo chsh -s "$FISH_SHELL"
fi
echo "fish ✓"
}
printf "\nbootstrapping...\n\n"
install_xcode
install_homebrew
install_brews
use_fish_shell
("$DOTS/scripts/setup_symlinks")
echo ""
echo "consider running other scripts:"
echo " - brews"
echo " - casks"
echo " - configure_macos"
echo " - rust"
echo " - cargos"
echo ""

View File

@ -1,15 +0,0 @@
#!/bin/sh
DOTS=$(dirname "$0")/..
cd "$DOTS" || (echo "Directory not found: $DOTS"; exit 1)
DOTS="$PWD"
all_brews() {
find "$DOTS/homebrew" \
-iname "*.Brewfile" \
-exec \
/usr/local/bin/brew bundle install --file "{}" \;
echo "all brews installed ✓"
}
all_brews

View File

@ -1,26 +0,0 @@
#!/bin/sh
DOTS=$(dirname "$0")/..
cd "$DOTS" || (echo "Directory not found: $DOTS"; exit 1)
DOTS="$PWD"
check_rust() {
if ! (which ~/.cargo/bin/rustup > /dev/null)
then
echo "Install rust (cargo) before continuing"
echo "Run the rust script before this one"
exit 1
fi
}
all_cargos() {
cargofile=$DOTS/cargo/Cargofile
sed 's/#.*$//g;/^$/d' "$cargofile" | while read -r line
do
cargo install "$line"
done \
&& echo "all cargos installed ✓"
}
check_rust
all_cargos

View File

@ -1,11 +0,0 @@
#!/bin/sh
install_casks() {
brewfile=$DOTS/homebrew/Caskfile
if ! (/usr/local/bin/brew bundle check --file "$brewfile" > /dev/null)
then
/usr/local/bin/brew bundle --file "$brewfile"
fi
echo "casks installed ✓"
}

View File

@ -1,29 +0,0 @@
#!/bin/sh
DOTS=$(dirname "$0")/..
cd "$DOTS" || (echo "Directory not found: $DOTS"; exit 1)
DOTS="$PWD"
setup_symlinks() {
for source in $(find "$DOTS" -iname "*.symlink")
do
dest="$HOME/.`basename \"${source%.*}\"`"
ln -sfn "$source" "$dest"
done
echo "symlinks ✓"
}
setup_configlinks() {
for source in $(find "$DOTS" -iname "*.configlink")
do
dest="$HOME/.config/`basename \"${source%.*}\"`"
ln -sfn "$source" "$dest"
done
echo "configlinks ✓"
}
setup_symlinks
setup_configlinks

View File

@ -1,19 +0,0 @@
#!/bin/sh
update_rust_analyzer() {
if ! (which rust-analyzer > /dev/null)
then
echo "not installed"
else
echo "removing"
rm /usr/local/bin/rust-analyzer
fi
echo "downloading rust analyzer"
rust_analyzer_bin=/usr/local/bin/rust-analyzer
curl -s -L https://github.com/rust-analyzer/rust-analyzer/releases/latest/download/rust-analyzer-mac -o $rust_analyzer_bin
chmod +x $rust_analyzer_bin
echo "rust-analyzer ✓"
}
update_rust_analyzer

View File

@ -1,102 +0,0 @@
# Colors for CoC
set-option -g default-terminal "screen-256color"
# Keep plenty of history for scrollback
set -g history-limit 100000
# Remove delay for entering copy mode
set-option -sg escape-time 0
# Horizontal and vertical splits
bind \\ split-window -h -c '#{pane_current_path}'
bind - split-window -v -c '#{pane_current_path}'
# Move between panes with vi keys
bind h select-pane -L
bind j select-pane -D
bind K select-pane -U
bind l select-pane -R
# Split out pane
bind b break-pane
# Synchronize panes
bind S set-window-option synchronize-panes
bind C-h resize-pane -L 10
bind C-l resize-pane -R 10
# Copy mode works as Vim
bind Escape copy-mode
bind k copy-mode
bind C-[ copy-mode
# Vi-style scrollback with prefix + C-[
set-window-option -g mode-keys vi
# Use v to trigger selection
bind-key -T copy-mode-vi v send-keys -X begin-selection
# Use y to yank current selection
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
# Enable mouse mode
set -g mouse on
# Status bar
set -g status-interval 60 # Seconds between refreshes
set -g renumber-windows on
set-option -g base-index 1 # Set 1 for first window (easier to type)
set-window-option -g pane-base-index 1 # Set 1 for first pane (easier to type)
set-option -g status-position bottom
################################
## COLORSCHEME: gruvbox dark
set-option -g status "on"
# Default statusbar color
set-option -g status-style bg=colour237,fg=colour223 # bg=bg1, fg=fg1
# Default window title colors
set-window-option -g window-status-style bg=colour214,fg=colour237 # bg=yellow, fg=bg1
# Default window with an activity alert
set-window-option -g window-status-activity-style bg=colour237,fg=colour248 # bg=bg1, fg=fg3
# Active window title colors
set-window-option -g window-status-current-style bg=red,fg=colour237 # fg=bg1
# Pane border
set-option -g pane-active-border-style fg=colour250 #fg2
set-option -g pane-border-style fg=colour237 #bg1
# Message infos
set-option -g message-style bg=colour239,fg=colour223 # bg=bg2, fg=fg1
# Writing commands inactive
set-option -g message-command-style bg=colour239,fg=colour223 # bg=fg3, fg=bg1
# Pane number display
set-option -g display-panes-active-colour colour250 #fg2
set-option -g display-panes-colour colour237 #bg1
# Clock
set-window-option -g clock-mode-colour colour109 #blue
# Bell
set-window-option -g window-status-bell-style bg=colour167,fg=colour235 # bg=red, fg=bg
# Theme settings mixed with colors (unfortunately, but there is no cleaner way)
set-option -g status-justify "left"
set-option -g status-left-style none
set-option -g status-left-length "80"
set-option -g status-right-style none
set-option -g status-right-length "80"
set-window-option -g window-status-separator ""
WEATHER='#(weather_cached)'
set-option -g status-left "#[fg=colour248, bg=colour241] #S #[fg=colour241, bg=colour237, nobold, noitalics, nounderscore]"
set-option -g status-right "#[fg=colour239, bg=colour237, nobold, nounderscore, noitalics]#[fg=colour246,bg=colour239] %Y-%m-%d  %H:%M #[fg=colour248, bg=colour239, nobold, noitalics, nounderscore]#[fg=colour237, nobold, bg=colour248] $WEATHER #[fg=colour237] "
set-window-option -g window-status-current-format "#[fg=colour237, bg=colour214, nobold, noitalics, nounderscore]#[fg=colour239, bg=colour214] #I #[fg=colour239, bg=colour214, bold] #W #[fg=colour214, bg=colour237, nobold, noitalics, nounderscore]"
set-window-option -g window-status-format "#[fg=colour237,bg=colour239,noitalics]#[fg=colour223,bg=colour239] #I #[fg=colour223, bg=colour239] #W #[fg=colour239, bg=colour237, noitalics]"