mirror of
https://github.com/nmasur/dotfiles
synced 2025-07-05 13:50:13 +00:00
remove some legacy config files
This commit is contained in:
@ -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"]
|
@ -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)
|
@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
python connect_cloud.py "$@"
|
||||
|
||||
/aws_connect
|
@ -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
|
@ -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}"
|
||||
}
|
@ -1,6 +1,13 @@
|
||||
#!/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
|
||||
|
||||
|
@ -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]}"
|
@ -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/{}"
|
@ -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"
|
Reference in New Issue
Block a user