add things resources from the last 5 years over machines

This commit is contained in:
autistic-symposium-helpers 2024-10-15 09:59:09 +09:00 committed by GitHub
parent ac9c955e0b
commit b0a4e417ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
77 changed files with 2327 additions and 84 deletions

View file

@ -1,10 +1,31 @@
Dotfiles and Scripts
====================
## dotfiles, shell scripts, and other scripts (decades of *nix 🐧)
Some sample of my config files (note: this is kinda like from years ago, but have fun)
<br>
OBVIOUSLY I DON'T INCLUDE SENSITIVE PARTS.
* **[bash scripts](shell_scripts)**
* **[awk](awk)**
* **[chef](chef)**
* **[git](git)**
* **[pgp](gpg)**
* **[tmux](tmux)**
* **[iterm](iterm)**
* **[network](network)**
* **[gcloud](gcloud)**
* **[vim](vim)**
* **[vscode](vscode)**
* **[vpn](vpn)**
* **[elastic search](elasticsearch)**
* **[data science](data_science)**
* **[ubuntu](ubuntu)**
* **[funny](funny)**
Some bash scripts, examples and useful stuff.
<br>
---
### external resources
<br>
* **[google style guide for shell](https://github.com/google/styleguide/blob/gh-pages/shellguide.md)**
* **[create a new ssh key](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) and [add to github](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account)**

View file

@ -3,19 +3,26 @@ Data Manipulation
Print elements in the column 3 that has the word "good" in the other columns
```
$ awk '/good/ { print $3 }' inventory
```
Syntax:
```
$ awk -f {PROGRAM FILE} FILENAME
```
awk program is:
```
PATTERN{
ACTION 1
ACTION 2
ACTION 3
}
```
. (Dot) Match any character
* Match zero or more character
@ -30,9 +37,10 @@ $ Match end of line
IF CONDITION
IF condition
------------
```
if (condition)
{
Statement 1
@ -47,7 +55,5 @@ else
Statement N
if condition is FALSE
}
```
FOR LOOP
--------

47
chef/README.md Normal file
View file

@ -0,0 +1,47 @@
## Chef Commands
Roles contain recipes:
```
$ knife role list
```
All the recipes that are in that role
```
$ knife role show <role_name>
```
To see the nodes:
```
$ knife node list
$ knife node show <node_name>
```
To register a brand new machine with chef
```
$ knife bootstrap
```
This will SSH into the machine, download chef package, install chef to `/opt`, and get it running and registered with the chef server, see `~/.chef/knife.rb`,
Before adding/pushing a change in chef
```
$ knife spork role from file roles/key.json
$ knife spork omni logstash --remote
```
when logstash version:
```
$ knife spork bump logstash
```
then
```
$ knife spork omni logstash --remote
```

View file

@ -1,58 +0,0 @@
# Change prefix key to Ctrl+p
# unbind C-b
# set -g prefix C-p
# More straight forward key bindings for splitting
unbind %
bind | split-window -h
unbind '"'
bind - split-window -v
# History
set -g history-limit 10000
# Terminal emulator window title
set -g set-titles on
set -g set-titles-string '[#S:#I.#H] #W'
# Status Bar
set-option -g status-bg white
set-option -g status-fg black
# Notifying if other windows has activities
setw -g monitor-activity off
set -g visual-activity on
# Clock
#setw -g clock-mode-colour green
#setw -g clock-mode-style 24
# Mouse Support
set -g mode-mouse on
set -g mouse-resize-pane on
set -g mouse-select-pane on
set -g mouse-select-window on
# Add SSH_TTY to the list of environment variables tmux knows about:
set-option -g update-environment "DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY SSH_TTY"
# Assume terminals want 256 colors
set-option -g default-terminal screen-256color
# Colors
# Status bar has a dim gray background
set-option -g status-bg colour234
set-option -g status-fg colour74
# Left shows the session name, in blue
set-option -g status-left-bg default
set-option -g status-left-fg colour74
# Right is some CPU stats, so terminal green
set-option -g status-right-bg default
set-option -g status-right-fg colour71
# Highlighting the active window in status bar
setw -g window-status-current-bg colour234
setw -g window-status-current-fg colour71
new-session

View file

@ -1,3 +0,0 @@
let g:netrw_dirhistmax =10
let g:netrw_dirhist_cnt =1
let g:netrw_dirhist_1='/Users/bt3_/Projects/blog/blog/output/author'

@ -1 +0,0 @@
Subproject commit b5d3fe66a58a13d2ff8b6391f4387608496a030f

@ -1 +0,0 @@
Subproject commit 96c07746b46c12d0aca7a5276cc5bd0a260b82fe

@ -1 +0,0 @@
Subproject commit 9c8468e83232c3e45b730d2d0b28d609053dec05

@ -1 +0,0 @@
Subproject commit 78566c37aeb3b7609eee84a7b10114a0f512830e

@ -1 +0,0 @@
Subproject commit 1c844375fa2762e3b7c16294fa36afee6fef28b1

@ -1 +0,0 @@
Subproject commit d0beb8ab42627bea2c747564ca46ec663e3ba0ba

View file

@ -1,4 +0,0 @@
let g:netrw_dirhistmax =10
let g:netrw_dirhist_cnt =2
let g:netrw_dirhist_1='/Users/marina/Projects/THREAT_INTEL/threat_intel/threat_intel/util'
let g:netrw_dirhist_2='/Users/marina/Projects/security-tools'

@ -1 +0,0 @@
Subproject commit cfd3b2d388a8c2e9903d7a9d80a65539aabfe933

View file

@ -0,0 +1,51 @@
#!/usr/bin/env python
"""
Export data in a CSV spreadsheet.
Mia Stein - 2017
Need to have argparse installed:
$ pip install argparse
"""
import sys
import argparse
from pandas import DataFrame
def read_data(data):
lines = data.readlines()
feature, precision, recall, f1 = [], [], [], []
for line in lines:
line_clean = line.strip().split(",")
feature.append(line_clean[0])
precision.append(line_clean[1])
recall.append(line_clean[4])
f1.append(line_clean[6])
return feature, precision, recall, f1
def save_to_spreadsheet(resultfile, data):
try:
df = DataFrame({'Feature': data[0], 'Precision': data[1], 'Recall': data[2], 'f1-score': data[3]})
df.to_csv(resultfile, index=False)
print("Spreadsheet saved at {0}".format(resultfile))
except:
print("Error: {0}".format(sys.exc_info()[0]))
def menu():
parser = argparse.ArgumentParser(description='Copy data results into a spreadsheet.')
parser.add_argument('-s', dest='input', type=argparse.FileType('r'), required=True, help="File with the results.")
parser.add_argument('-d', dest='output', required=True, help="The name of the file to save the spreadsheet.")
args = parser.parse_args()
args.input, args.output
return args.input, args.output
if __name__ == "__main__":
datafile, resultfile = menu()
data = read_data(datafile)
save_to_spreadsheet(resultfile, data)

View file

@ -0,0 +1,46 @@
#!/usr/bin/env python
# Need to have argparse installed:
# $ pip install argparse
import sys
import os.path
import argparse
from pandas import DataFrame
def read_data(data):
lines = data.readlines()
feature, precision, recall, f1 = [], [], [], []
for line in lines:
line_clean = line.strip().split(",")
feature.append(line_clean[0])
precision.append(line_clean[1])
recall.append(line_clean[4])
f1.append(line_clean[6])
return feature, precision, recall, f1
def save_to_spreadsheet(resultfile, data):
try:
df = DataFrame({'Feature': data[0], 'Precision': data[1], 'Recall': data[2], 'f1-score': data[3]})
df.to_csv(resultfile, index=False)
print("Spreadsheet saved at {0}".format(resultfile))
except:
print("Error: {0}".format(sys.exc_info()[0]))
def menu():
parser = argparse.ArgumentParser(description='Copy data results into a spreadsheet.')
parser.add_argument('-s', dest='input', type=argparse.FileType('r'), required=True, help="File with the results.")
parser.add_argument('-d', dest='output', required=True, help="The name of the file to save the spreadsheet.")
args = parser.parse_args()
args.input, args.output
return args.input, args.output
if __name__ == "__main__":
datafile, resultfile = menu()
data = read_data(datafile)
save_to_spreadsheet(resultfile, data)

226
data_science/run_eval.py Normal file
View file

@ -0,0 +1,226 @@
#!/usr/bin/env python
"""
Run svm_light, parse its stdout, calculate
ML scores, HDFS copy data to local.
"""
import sys
import os
import getpass
import subprocess
import shutil
import math
def delete_dir(dir_path):
'''
Remove a directory.
Args:
dir_path: full path to the directory.
'''
if os.path.isdir(dir_path):
shutil.rmtree(dir_path)
def usage():
'''
Handle the CLI arguments.
'''
args = sys.argv
if len(args) != 3:
print("Usage: ./runEval <method> <version>")
sys.exit(2)
return args[1], args[2]
def create_dir(dir_path):
'''
Create a a directory.
Args:
dir_path: full path to the directory.
'''
if not os.path.exists(dir_path):
os.makedirs(dir_path)
def run_svm_classify(test_data, svml_model, svml_eval):
'''
Spawn a subprocess to run svm_classify binary.
From svm_classify.c, svm_light usage requires the following
arguments: example_file model_file output_file.
Args:
test_data: path_to_feature/test.dat
svml_model: something like ~/data/models/svmlight/method/version/model
svml_eval: something like ~/data/models/svmlight/method/version/eval
Returns:
Strings with stdout and stderr so that it can be parsed later.
'''
p = subprocess.Popen(['./models/svm_classify', \
'{0}'.format(test_data), \
'{0}'.format(svml_model),\
'{0}'.format(svml_eval)],\
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out, err = p.communicate()
return out, err
def paste_data(test_data, svml_eval, final_eval, svml_alpha, final_alphas, out):
'''
Copy all eval and alpha data from results to local files.
Args:
src and dst paths.
'''
# Copy all eval data.
with open(test_data, 'r') as ft:
test_data = ft.readlines()
with open(svml_eval, 'r') as fe:
eval_data = fe.readlines()
with open(final_eval, 'a') as f:
for line in test_data:
f.write('{0}\n'.format(line))
for line in eval_data:
f.write('{0}\n'.format(line))
# Copy all alpha data.
with open(svml_alpha, 'r') as fa:
alpha_data = fa.readlines()
with open(final_alphas, 'a') as f:
for line in alpha_data:
f.write('{0} {1}\n'.format(line, out))
def parse_svmlight_output(out):
'''
Parse the svm_light stdout string for an example
Returns:
c: counts
p: precision
r: recall
'''
c = out.split('OK. (')[1].split(' support')[0]
pr = out.split('Precision/recall on test set: ')[1].split(' support')[0].strip()
p, r = pr.split('/')
p = float(p.strip('%').strip()) / 100
r = float(r.strip('%').strip()) / 100
return c, p, r
def hdfs_copy_data(home_dir, method, version):
'''
Run CLI HDFS commands to clean up and save data.
'''
os.system('hdfs dfs -rm /data/shared/structdata/modelOutput/{0}/{1}/scores'.format(method, version))
os.system('hdfs dfs -rm /data/shared/structdata/modelOutput/{0}/{1}/alphas'.format(method, version))
os.system('hdfs dfs -mkdir /data/shared/structdata/modelOutput/{0}/{1}'.format(method, version))
os.system('hdfs dfs -copyFromLocal {0}/data/eval/{1}/{2}/alphas \
/data/shared/structdata/modelOutput/{3}/{4}/alphas'.format(home_dir, version, method, method, version))
os.system('hdfs dfs -copyFromLocal {0}/data/eval/{1}/{2}/eval \
/data/shared/structdata/modelOutput/{3}/{4}/scores'.format(home_dir, version, method, method, version))
def calculate_scores(list_of_scores):
'''
Calculate the mean of a given list of scores,
taking care of any nan or 0 division.
'''
c, score = 0, 0
for i in list_of_scores:
if not math.isnan(i):
c += 1
score += i
if c > 0:
return score / c
else:
return 0
def calculate_f1(precision, recall):
'''
Calculates the f1-score as the harmonic
mean of precision and recall.
'''
if precision + recall < 1:
return 0
else:
return 2 / (1/precision + 1/recall)
if __name__ == '__main__':
# Grab the CLI arguments.
METHOD, VERSION = usage()
# Setup output dirs.
home_dir = os.path.join('/home', getpass.getuser())
final_dir = os.path.join(home_dir, 'data/eval', VERSION, METHOD)
final_alphas = os.path.join(final_dir, 'alphas')
final_eval = os.path.join(final_dir, 'eval')
delete_dir(final_alphas)
delete_dir(final_eval)
create_dir(final_dir)
# Loop over the attributes and features.
training_data_dir = os.path.join(home_dir, 'data/training_data/', VERSION, METHOD)
for attribute in os.listdir(training_data_dir):
attribute_path = os.path.join(training_data_dir, attribute)
counts = 0
precision, recall = [], []
for feature in os.listdir(attribute_path):
# Create all the paths in use.
out = os.path.join(VERSION, METHOD, attribute, feature)
svmlight = os.path.join(home_dir,'data/models/svmlight', out)
svml_model = os.path.join(svmlight, 'model')
svml_eval = os.path.join(svmlight, 'eval')
svml_alpha = os.path.join(svmlight, 'alphas')
test_data = os.path.join(attribute_path, feature, 'test.dat')
# Run svm_classify.
out, err = run_svm_classify(test_data, svml_model, svml_eval)
# Save current results.
paste_data(test_data, svml_eval, final_eval, svml_alpha, final_alphas, out)
# Parse output from svm_classify to print to stdout.
if err:
print('Error: {0}'.format(err))
# Get Train counts, Test counts, Accuracy, Precision, Recall.
c, p ,r = parse_svmlight_output(out)
counts += int(c)
precision.append(p)
recall.append(r)
attribute_precision = calculate_scores(precision)
attribute_recall = calculate_scores(recall)
attribute_f1 = calculate_f1(attribute_precision, attribute_recall)
print("{: <20} Counts: {: <20} Precision: {: <20} Recall: {: <20} F1-score: {: <20}".format(attribute.title(), \
counts, round(attribute_precision, 4), round(attribute_recall, 4), round(attribute_f1, 4)))
# Copying results from remote hdfs.
print("\nCopying results to hdfs")
hdfs_copy_data(home_dir, METHOD, VERSION)
print("\nDone!".format())

6
elasticsearch/README.md Normal file
View file

@ -0,0 +1,6 @@
# Elastalert hacks
```
curl -s logs.HOST.com:9200/logstash-2017.09.08/_search\?q=ty_params.ProcessName:osqueryd\&size=10000\&sort=@timestamp:desc | jq -r '.hits.hits[]._source.ty_params.Username' | sort | uniq -c | sort -nr
```

View file

@ -0,0 +1,50 @@
#!/usr/bin/env python
import elasticsearch
import whois
import json
from elasticsearch import Elasticsearch
es = Elasticsearch([{ 'host': "HOST NAME"}])
query = {
'size': 100,
'query': {
'filtered': {
'query': {
'query_string': {
'query': 'type:named_query_log',
'analyze_wildcard': True
}
},
'filter': {
'bool': {
'must_not': {
'query_string': {
'query': '*HOST.com OR *otherhost.com',
'analyze_wildcard': True
}
}
}
}
}}}
# Make the search
res = es.search(index="LOG-NAME", body=query)
results = []
counter = 0
# Print out our results
for hit in res['hits']['hits']:
if "dns_dest" in hit['_source'].keys():
try:
results.append(json.dumps(whois.whois(hit['_source']['dns_dest'])))
except Exception as e:
pass
counter += 1
print "Scanning {0}/{1} domains, {2} succeeded..".format(counter, len(res['hits']['hits']), len(results))
with open('processed_domains.txt', 'w') as outfile:
json.dump(results, outfile)

50
elasticsearch/set_log.py Normal file
View file

@ -0,0 +1,50 @@
#!/usr/bin/env python
import os
import subprocess
import json
import socket
import logging
LOG_PATH = "/var/log/logname.log"
FORWARD_PATH = "/etc/logstash-forwarder.conf"
LOG_LEVEL = logging.DEBUG
# Set up logpath
if not os.path.isfile(LOG_PATH):
logging.info("No {0} file. Calling: sudo touch {1}".format(LOG_PATH, LOG_PATH))
subprocess.call("sudo touch {0}".format(LOG_PATH), shell=True)
logging.info("Setting perms. Calling: sudo chmod 666 {0}".format(LOG_PATH))
subprocess.call("sudo chmod 666 {0}".format(LOG_PATH), shell=True)
# Set up forwarding
if os.path.isfile(FORWARD_PATH):
logging.info("Forwarding {0} to logstash...".format(FORWARD_PATH))
try:
with open(FORWARD_PATH, "r+") as f:
data = json.load(jsonFile)
try:
if LOG_PATH not in data['files'][0]['paths']:
data['files'][0]['paths'].append(LOG_PATH)
jsonFile = open("/etc/logstash-forwarder.conf", "w+")
jsonFile.write(json.dumps(data))
except KeyError:
logging.error("Could not set logstash: {0} is not well formated.".format(FORWARD_PATH))
except IOError:
logging.error("Could not open {0}".format(FORWARD_PATH))
else:
hostname = socket.gethostname()
#Search for logstash-forwarder locations per each host
if "prodvpn" in hostname:
logging.warning("Forwarder should be in {0}. Please set up a forwarder and try again.".format(FORWARD_PATH))

View file

@ -1 +1,3 @@
echo -e "\e[1;40m" ; clear ; while :; do echo $LINES $COLUMNS $(( $RANDOM % $COLUMNS)) $(( $RANDOM % 72 )) ;sleep 0.05; done|gawk '{ letters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()"; c=$4; letter=substr(letters,c,1);a[$3]=0;for (x in a) {o=a[x];a[x]=a[x]+1; printf "\033[%s;%sH\033[2;32m%s",o,x,letter; printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,letter;if (a[x] >= $1) { a[x]=0; } }}'
#!/usr/bin/env bash
echo -e "\e[1;40m" ; clear ; while :; do echo $LINES $COLUMNS $(( $RANDOM % $COLUMNS)) $(( $RANDOM % 72 )) ;sleep 0.05; done|gawk '{ letters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()"; c=$4; letter=substr(letters,c,1);a[$3]=0;for (x in a) {o=a[x];a[x]=a[x]+1; printf "\033[%s;%sH\033[2;32m%s",o,x,letter; printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,letter;if (a[x] >= $1) { a[x]=0; } }}'

View file

@ -0,0 +1,7 @@
#!/bin/bash
for x in $(gcloud projects list | tail -n +2 | awk '{ print $1}');
do
gcloud sql instances list --project $x
done

13
gcloud/get_gcp_apps.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/bash
projects=$(gcloud projects list | tail -n +2 | awk '{ print $1}')
list_app () {
gcloud app services list --project $1 2>&1 | grep -v ERROR
}
for x in $projects;
do
list_app $x
done

10
gcloud/get_kb8_clusters.sh Executable file
View file

@ -0,0 +1,10 @@
#!/bin/bash
projects=$(gcloud projects list | tail -n +2 | awk '{ print $1}');
for x in $projects;
do
project_json=$(gcloud container clusters list --project $x --format json)
echo $project_json | jq -e -r '.[] | .endpoint'
done

8
gcloud/get_public_ips.sh Executable file
View file

@ -0,0 +1,8 @@
#!/bin/bash
for x in $(gcloud projects list | tail -n +2 | awk '{ print $1}');
do
ip_list=$(gcloud compute instances list --project $x --format json)
gcloud compute instances list --project $x --format json | jq -r '.[] | .networkInterfaces[] | .accessConfigs[] | .natIP';
done

74
git/README.md Normal file
View file

@ -0,0 +1,74 @@
## useful git stuff
<br>
### reset all commits
<br>
#### check out to a temporary branch:
```
git checkout --orphan TEMP_BRANCH
```
#### add all the files:
```
git add -A
```
#### commit the changes:
```
git commit -am "🛹👾"
```
#### delete the old branch:
```
git branch -D main
```
#### rename the temporary branch to `main`:
```
git branch -m main
```
#### finally, force update to our repository:
```
git push -f origin main
```
<br>
---
### delete all local branches
<br>
```shell
git branch | grep -v "main" | xargs git branch -D
```
<br>
---
### troubleshooting
<br>
#### error: RPC failed; HTTP 400 curl 22 The requested URL returned error: 400
```shell
git config http.postBuffer 524288000
```
<br>

58
gpg/README.md Normal file
View file

@ -0,0 +1,58 @@
## gpg shortcuts
<br>
(adapted from [bt3gl's 20216 guide](https://coderwall.com/p/ajtlqa/getting-started-with-pgp-gpg))
1. create a key (choose RSA with 4096):
```
gpg --full-generate-key
```
<br>
2. share the public key with:
```
gpg --armor --export > public-key.asc
```
<br>
3. upload to some keyservers, such as ubuntu or MIT:
```
gpg --send-keys --keyserver keyserver.ubuntu.com KEYID
gpg --keyserver hkp://pgp.mit.edu --send-key KEYID
```
<br>
4. backup the private key:
```
gpg --export-secret-keys --armor KEYID > priv.asc
```
<br>
5. list your keys:
```
gpg --list-keys
gpg --list-secret-keys
```
<br>
6. clean up if needed:
```
gpg --delete-secret-key KEYID
gpg --delete-key KEYID
```
<br>
7. finally, you should upload your key into official servers such as **[ubuntu](https://keyserver.ubuntu.com/)** or **[mit](https://pgp.mit.edu/)**.

379
iterm/iterm_profile.json Normal file
View file

@ -0,0 +1,379 @@
{
"Ansi 4 Color" : {
"Red Component" : 0.49340518936514854,
"Color Space" : "sRGB",
"Blue Component" : 0.7667236328125,
"Alpha Component" : 1,
"Green Component" : 0.54157522728399154
},
"Tags" : [
],
"Ansi 12 Color" : {
"Red Component" : 0.369100421667099,
"Color Space" : "sRGB",
"Blue Component" : 0.90869140625,
"Alpha Component" : 1,
"Green Component" : 0.43231727316288016
},
"Ansi 7 Color" : {
"Green Component" : 0.73333334922790527,
"Blue Component" : 0.73333334922790527,
"Red Component" : 0.73333334922790527
},
"Ansi 8 Color" : {
"Green Component" : 0.3333333432674408,
"Blue Component" : 0.3333333432674408,
"Red Component" : 0.3333333432674408
},
"Bold Color" : {
"Green Component" : 1,
"Blue Component" : 1,
"Red Component" : 1
},
"Ansi 9 Color" : {
"Red Component" : 1,
"Color Space" : "sRGB",
"Blue Component" : 0,
"Alpha Component" : 1,
"Green Component" : 0.041481197916263146
},
"Right Option Key Sends" : 0,
"Ansi 6 Color" : {
"Red Component" : 0,
"Color Space" : "sRGB",
"Blue Component" : 1,
"Alpha Component" : 1,
"Green Component" : 0.99052921849475251
},
"Rows" : 25,
"Default Bookmark" : "No",
"Cursor Guide Color" : {
"Red Component" : 0.70213186740875244,
"Color Space" : "sRGB",
"Blue Component" : 1,
"Alpha Component" : 0.25,
"Green Component" : 0.9268307089805603
},
"Non-ASCII Anti Aliased" : true,
"Use Bright Bold" : true,
"Ansi 10 Color" : {
"Red Component" : 0,
"Color Space" : "sRGB",
"Blue Component" : 0,
"Alpha Component" : 1,
"Green Component" : 1
},
"Ambiguous Double Width" : false,
"Jobs to Ignore" : [
"rlogin",
"ssh",
"slogin",
"telnet"
],
"Ansi 15 Color" : {
"Green Component" : 1,
"Blue Component" : 1,
"Red Component" : 1
},
"Foreground Color" : {
"Green Component" : 0.73333334922790527,
"Blue Component" : 0.73333334922790527,
"Red Component" : 0.73333334922790527
},
"Working Directory" : "\/Users\/mia",
"Blinking Cursor" : true,
"Disable Window Resizing" : true,
"Sync Title" : false,
"Prompt Before Closing 2" : false,
"BM Growl" : true,
"Command" : "",
"Description" : "Default",
"Mouse Reporting" : true,
"Screen" : -1,
"Selection Color" : {
"Green Component" : 0.8353000283241272,
"Blue Component" : 1,
"Red Component" : 0.70980000495910645
},
"Columns" : 80,
"Idle Code" : 0,
"Ansi 13 Color" : {
"Red Component" : 0,
"Color Space" : "sRGB",
"Blue Component" : 1,
"Alpha Component" : 1,
"Green Component" : 0.5572509765625
},
"Custom Command" : "No",
"Use Custom Window Title" : false,
"ASCII Anti Aliased" : true,
"Non Ascii Font" : "Monaco 12",
"Vertical Spacing" : 1.0900000000000001,
"Use Bold Font" : true,
"Option Key Sends" : 0,
"Selected Text Color" : {
"Green Component" : 0,
"Blue Component" : 0,
"Red Component" : 0
},
"Background Color" : {
"Green Component" : 0,
"Blue Component" : 0,
"Red Component" : 0
},
"Character Encoding" : 4,
"Ansi 11 Color" : {
"Green Component" : 1,
"Blue Component" : 0.3333333432674408,
"Red Component" : 1
},
"Use Italic Font" : true,
"Unlimited Scrollback" : true,
"Keyboard Map" : {
"0xf700-0x260000" : {
"Text" : "[1;6A",
"Action" : 10
},
"0x37-0x40000" : {
"Text" : "0x1f",
"Action" : 11
},
"0x32-0x40000" : {
"Text" : "0x00",
"Action" : 11
},
"0xf709-0x20000" : {
"Text" : "[17;2~",
"Action" : 10
},
"0xf70c-0x20000" : {
"Text" : "[20;2~",
"Action" : 10
},
"0xf729-0x20000" : {
"Text" : "[1;2H",
"Action" : 10
},
"0xf72b-0x40000" : {
"Text" : "[1;5F",
"Action" : 10
},
"0xf705-0x20000" : {
"Text" : "[1;2Q",
"Action" : 10
},
"0xf703-0x260000" : {
"Text" : "[1;6C",
"Action" : 10
},
"0xf700-0x220000" : {
"Text" : "[1;2A",
"Action" : 10
},
"0xf701-0x280000" : {
"Text" : "0x1b 0x1b 0x5b 0x42",
"Action" : 11
},
"0x38-0x40000" : {
"Text" : "0x7f",
"Action" : 11
},
"0x33-0x40000" : {
"Text" : "0x1b",
"Action" : 11
},
"0xf703-0x220000" : {
"Text" : "[1;2C",
"Action" : 10
},
"0xf701-0x240000" : {
"Text" : "[1;5B",
"Action" : 10
},
"0xf70d-0x20000" : {
"Text" : "[21;2~",
"Action" : 10
},
"0xf702-0x260000" : {
"Text" : "[1;6D",
"Action" : 10
},
"0xf729-0x40000" : {
"Text" : "[1;5H",
"Action" : 10
},
"0xf706-0x20000" : {
"Text" : "[1;2R",
"Action" : 10
},
"0x34-0x40000" : {
"Text" : "0x1c",
"Action" : 11
},
"0xf700-0x280000" : {
"Text" : "0x1b 0x1b 0x5b 0x41",
"Action" : 11
},
"0x2d-0x40000" : {
"Text" : "0x1f",
"Action" : 11
},
"0xf70e-0x20000" : {
"Text" : "[23;2~",
"Action" : 10
},
"0xf702-0x220000" : {
"Text" : "[1;2D",
"Action" : 10
},
"0xf703-0x280000" : {
"Text" : "0x1b 0x1b 0x5b 0x43",
"Action" : 11
},
"0xf700-0x240000" : {
"Text" : "[1;5A",
"Action" : 10
},
"0xf707-0x20000" : {
"Text" : "[1;2S",
"Action" : 10
},
"0xf70a-0x20000" : {
"Text" : "[18;2~",
"Action" : 10
},
"0x35-0x40000" : {
"Text" : "0x1d",
"Action" : 11
},
"0xf70f-0x20000" : {
"Text" : "[24;2~",
"Action" : 10
},
"0xf703-0x240000" : {
"Text" : "[1;5C",
"Action" : 10
},
"0xf701-0x260000" : {
"Text" : "[1;6B",
"Action" : 10
},
"0xf702-0x280000" : {
"Text" : "0x1b 0x1b 0x5b 0x44",
"Action" : 11
},
"0xf72b-0x20000" : {
"Text" : "[1;2F",
"Action" : 10
},
"0x36-0x40000" : {
"Text" : "0x1e",
"Action" : 11
},
"0xf708-0x20000" : {
"Text" : "[15;2~",
"Action" : 10
},
"0xf701-0x220000" : {
"Text" : "[1;2B",
"Action" : 10
},
"0xf70b-0x20000" : {
"Text" : "[19;2~",
"Action" : 10
},
"0xf702-0x240000" : {
"Text" : "[1;5D",
"Action" : 10
},
"0xf704-0x20000" : {
"Text" : "[1;2P",
"Action" : 10
}
},
"Window Type" : 1,
"Cursor Boost" : 0,
"Cursor Type" : 0,
"Background Image Location" : "",
"Blur" : false,
"Badge Color" : {
"Red Component" : 1,
"Color Space" : "sRGB",
"Blue Component" : 0,
"Alpha Component" : 0.5,
"Green Component" : 0.1491314172744751
},
"Blink Allowed" : false,
"Scrollback Lines" : 0,
"Send Code When Idle" : false,
"Close Sessions On End" : true,
"Terminal Type" : "xterm-256color",
"Visual Bell" : true,
"Flashing Bell" : false,
"Silence Bell" : false,
"Ansi 14 Color" : {
"Red Component" : 1,
"Color Space" : "sRGB",
"Blue Component" : 0.70697021484375,
"Alpha Component" : 1,
"Green Component" : 0
},
"Name" : "Default",
"Cursor Text Color" : {
"Green Component" : 1,
"Blue Component" : 1,
"Red Component" : 1
},
"Minimum Contrast" : 0,
"Shortcut" : "",
"Cursor Color" : {
"Green Component" : 0.73333334922790527,
"Blue Component" : 0.73333334922790527,
"Red Component" : 0.73333334922790527
},
"Ansi 0 Color" : {
"Green Component" : 0,
"Blue Component" : 0,
"Red Component" : 0
},
"Guid" : "77B335E5-2787-4854-B408-FF002FEE6AE0",
"Custom Directory" : "No",
"Ansi 3 Color" : {
"Green Component" : 0.73333334922790527,
"Blue Component" : 0,
"Red Component" : 0.73333334922790527
},
"Link Color" : {
"Red Component" : 0,
"Color Space" : "sRGB",
"Blue Component" : 0.73423302173614502,
"Alpha Component" : 1,
"Green Component" : 0.35916060209274292
},
"Ansi 5 Color" : {
"Red Component" : 0.82745098039215681,
"Color Space" : "sRGB",
"Blue Component" : 0.82745098039215681,
"Alpha Component" : 1,
"Green Component" : 0.52941176470588236
},
"Use Non-ASCII Font" : false,
"Transparency" : 0,
"Normal Font" : "Courier 14",
"Ansi 1 Color" : {
"Red Component" : 0.921539306640625,
"Color Space" : "sRGB",
"Blue Component" : 0.40294846147298813,
"Alpha Component" : 1,
"Green Component" : 0.47305398313954738
},
"Ansi 2 Color" : {
"Red Component" : 0.54448666982352734,
"Color Space" : "sRGB",
"Blue Component" : 0.54448666982352734,
"Alpha Component" : 1,
"Green Component" : 0.829925537109375
},
"Horizontal Spacing" : 1
}

23
network/check_port.sh Normal file
View file

@ -0,0 +1,23 @@
#!/bin/bash
# Check a whether a port is open or not
#
# then use the script in your tests like
# check_port 9200
function check_port() {
local host=${1} && shift
local port=${1} && shift
local retries=5
local wait=1
until( nc -zv "${host}" "${port}" ); do
((retries--))
if [ $retries -lt 0 ]; then
echo "Service ${host}:${port} didn't become ready in time."
exit 1
fi
sleep "${wait}"
done
}
check_port "localhost" "$@"

View file

@ -1,5 +1,5 @@
######################################################
# bt3's .bashrc (partially modified for publishing)
# mia's .bashrc (partially modified for publishing)
######################################################
#
##

153
shell/profile Normal file
View file

@ -0,0 +1,153 @@
######################################################
# PRETTY STUFF
######################################################
# Normal Colors
Black='\e[0;30m' # Black
Red='\e[0;31m' # Red
Green='\e[0;32m' # Green
Yellow='\e[0;33m' # Yellow
Blue='\e[0;34m' # Blue
Purple='\e[0;35m' # Purple
Cyan='\e[0;36m' # Cyan
White='\e[0;37m' # White
# Bold
BBlack='\e[1;30m' # Black
BRed='\e[1;31m' # Red
BGreen='\e[1;32m' # Green
BYellow='\e[1;33m' # Yellow
BBlue='\e[1;34m' # Blue
BPurple='\e[1;35m' # Purple
BCyan='\e[1;36m' # Cyan
BWhite='\e[1;37m' # White
# Background
On_Black='\e[40m' # Black
On_Red='\e[41m' # Red
On_Green='\e[42m' # Green
On_Yellow='\e[43m' # Yellow
On_Blue='\e[44m' # Blue
On_Purple='\e[45m' # Purple
On_Cyan='\e[46m' # Cyan
On_White='\e[47m' # White
NC="\e[m" # Color Reset
# \a an ASCII bell character (07)
# \d the date in "Weekday Month Date" format (e.g., "Tue May 26")
# \] end a sequence of non-printing characters
# \e an ASCII escape character (033)
# \h the hostname up to the first `.'
# \H the hostname
# \j the number of jobs currently managed by the shell
# \l the basename of the shell's terminal device name
# \n newline
# \r carriage return
# \s the name of the shell, the basename of $0 (the portion following the final slash)
# \t the current time in 24-hour HH:MM:SS format
# \T the current time in 12-hour HH:MM:SS format
# \@ the current time in 12-hour am/pm format
# \A the current time in 24-hour HH:MM format
# \u the username of the current user
# \v the version of bash (e.g., 2.00)
# \V the release of bash, version + patchelvel (e.g., 2.00.0)
# \w the current working directory
# \W the basename of the current working directory
# \! the history number of this command
# \# the command number of this command
# \$ if the effective UID is 0, a #, otherwise a $
# \nnn the character corresponding to the octal number nnn
# \\ a backslash
# \[ begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the prompt
PS1='\[\e[1;32m\]\d \T> \[\e[1;35m\]\h> \[\e[1;34m\] \w: \[\e[m\]'
######################################################
# PERSONAL ALIASES
######################################################
alias home='cd ~'
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias mkdir='mkdir -p'
alias h='history'
alias j='jobs -l'
alias which='type -a'
alias ..='cd ..'
alias jup="jupyter notebook"
# Pretty-print of some PATH variables:
alias path='echo -e ${PATH//:/\\n}'
alias libpath='echo -e ${LD_LIBRARY_PATH//:/\\n}'
alias du='du -kh' # Makes a more readable output.
alias df='df -kTh'
alias dc="docker-compose"
alias dcrun="docker-compose run --rm"
######################################################
# EXPORT OPTIONS
######################################################
export GREP_OPTIONS='--color=auto'
export GREP_COLOR='1;31' # green for matches
export CLICOLOR=230
export HISTFILESIZE=3000
export HISTCONTROL=ignoredups
######################################################
# FUNCTIONS
######################################################
function extract() # Handy Extract Program
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xvf $1 ;;
*.tbz2) tar xvjf $1 ;;
*.tgz) tar xvzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via >extract<" ;;
esac
else
echo "'$1' is not a valid file!"
fi
}
# Function to run upon exit of shell.
function _exit()
{
echo -e "${BRed}Hasta la vista, Baby! ${NC}"
}
trap _exit EXIT
# Creates an archive (*.tar.gz) from given directory.
function maketar() { tar cvzf "${1%%/}.tar.gz" "${1%%/}/"; }
# Create a ZIP archive of a file or folder.
function makezip() { zip -r "${1%%/}.zip" "$1" ; }
# Make your directories and files access rights sane.
function sanitize() { chmod -R u=rwX,g=rX,o= "$@" ;}
export PATH="/usr/local/opt/openssl/bin:$PATH"
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/mia/Desktop/google-cloud-sdk/path.bash.inc' ]; then . '/Users/mia/Desktop/google-cloud-sdk/path.bash.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/Users/mia/Desktop/google-cloud-sdk/completion.bash.inc' ]; then . '/Users/mia/Desktop/google-cloud-sdk/completion.bash.inc'; fi

View file

@ -0,0 +1,50 @@
# Some Quick and Useful Shell Commands
<br>
## Downloading all pdfs of url
```shell
$ wget --recursive --level=2 --no-directories --no-host-directories --accept pdf
```
<br>
## Extended attributes of files
```shell
$ xattr -l $file
```
<br>
## Check signatures of Apps
<br>
```shell
$ codesign -dvvv $file.app
```
<br>
## Show all the configs
<br>
```shell
$ system_profiler -detaillevel full
```
<br>
## 瑪麗
<br>
```shell
$ convert -size 360x360 xc:white -font "FreeMono" -pointsize 12 -fill black -draw @ascii.txt
```

View file

@ -0,0 +1,9 @@
#!/bin/sh
# Set a random timezone
TZ_SIGN=$( echo "+:-" | cut -d: -f "$( shuf -i 1-2 -n 1 )" )
TZ=UTC${TZ_SIGN}$( shuf -i 0-24 -n1 )
export TZ
echo "Set TZ to: ${TZ}"

3
shell_scripts/rsync.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
VM=vm_dev
rsync -avz -e ssh <local dir> ${VM}:<remote dir> --exclude-from ~/.rsync-excludes

3
shell_scripts/sshfs.sh Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
/usr/local/bin/sshfs vm_dev:<remove dir> <mount local dir>

50
tmux/README.md Normal file
View file

@ -0,0 +1,50 @@
## Basic Tmux Usage
<br>
* Starting a new (named session):
```
tmux new -s my_session
```
<br>
* Detach the session with `Ctrl-b + d`.
<br>
* List sessions with:
```
tmux ls
```
<br>
* Re-attach a session:
```
tmux attach-session -t my_session
```
<br>
* Reload a tmux config file:
```
tmux source-file ~/.tmux.conf
```
<br>
* Kill tmux
```
tmux kill-server
```

43
tmux/tmux-config/.gitattributes vendored Normal file
View file

@ -0,0 +1,43 @@
# common settings that generally should always be used with your language specific settings
# Auto detect text files and perform LF normalization
# http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/
* text=auto
#
# The above will handle all files NOT found below
#
# Documents
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
*.md text
*.adoc text
*.textile text
*.mustache text
*.csv text
*.tab text
*.tsv text
*.sql text
# Graphics
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.tif binary
*.tiff binary
*.ico binary
# SVG treated as an asset (binary) by default. If you want to treat it as text,
# comment-out the following line and uncomment the line after.
*.svg binary
#*.svg text
*.eps binary

28
tmux/tmux-config/.gitignore vendored Normal file
View file

@ -0,0 +1,28 @@
### https://raw.github.com/github/gitignore/8ab86f6bb71e85b5046f1d921bbbe5ceec9063ba/Global/OSX.gitignore
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

View file

@ -0,0 +1,46 @@
FROM debian:stretch-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
fontconfig \
git \
gcc \
iputils-ping \
libevent-dev \
libncurses-dev \
locales \
make \
procps \
wget \
&& wget -O - https://github.com/tmux/tmux/releases/download/2.6/tmux-2.6.tar.gz | tar xzf - \
&& cd tmux-2.6 \
&& LDFLAGS="-L/usr/local/lib -Wl,-rpath=/usr/local/lib" ./configure --prefix=/usr/local \
&& make \
&& make install \
&& cd .. \
&& rm -rf tmux-2.6 \
&& apt-get purge -y gcc make \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
&& locale-gen
ENV LC_ALL=en_US.UTF-8
ENV LANG=en_US.UTF-8
RUN mkdir -p $HOME/.fonts $HOME/.config/fontconfig/conf.d \
&& wget -P $HOME/.fonts https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf \
&& wget -P $HOME/.config/fontconfig/conf.d/ https://github.com/powerline/powerline/raw/develop/font/10-powerline-symbols.conf \
&& fc-cache -vf $HOME/.fonts/
WORKDIR /root
RUN git clone https://github.com/samoshkin/tmux-config \
&& ./tmux-config/install.sh \
&& rm -rf ./tmux-config
ENV TERM=xterm-256color

43
tmux/tmux-config/install.sh Executable file
View file

@ -0,0 +1,43 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
is_app_installed() {
type "$1" &>/dev/null
}
REPODIR="$(cd "$(dirname "$0")"; pwd -P)"
cd "$REPODIR";
if ! is_app_installed tmux; then
printf "WARNING: \"tmux\" command is not found. \
Install it first\n"
exit 1
fi
if [ ! -e "$HOME/.tmux/plugins/tpm" ]; then
printf "WARNING: Cannot found TPM (Tmux Plugin Manager) \
at default location: \$HOME/.tmux/plugins/tpm.\n"
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
fi
if [ -e "$HOME/.tmux.conf" ]; then
printf "Found existing .tmux.conf in your \$HOME directory. Will create a backup at $HOME/.tmux.conf.bak\n"
fi
cp -f "$HOME/.tmux.conf" "$HOME/.tmux.conf.bak" 2>/dev/null || true
cp -a ./tmux/. "$HOME"/.tmux/
ln -sf .tmux/tmux.conf "$HOME"/.tmux.conf;
# Install TPM plugins.
# TPM requires running tmux server, as soon as `tmux start-server` does not work
# create dump __noop session in detached mode, and kill it when plugins are installed
printf "Install TPM plugins\n"
tmux new -d -s __noop >/dev/null 2>&1 || true
tmux set-environment -g TMUX_PLUGIN_MANAGER_PATH "~/.tmux/plugins"
"$HOME"/.tmux/plugins/tpm/bin/install_plugins || true
tmux kill-session -t __noop >/dev/null 2>&1 || true
printf "OK: Completed\n"

View file

@ -0,0 +1,6 @@
Tmux configuration, that supercharges your [tmux](https://tmux.github.io/) and builds cozy and cool terminal environment.
```
$ ./tmux-config/install.sh
```

View file

@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -eu
pane_fmt="#{pane_id} #{pane_in_mode} #{pane_input_off} #{pane_dead} #{pane_current_command}"
tmux list-panes -s -F "$pane_fmt" | awk '
$2 == 0 && $3 == 0 && $4 == 0 && $5 ~ /(bash|zsh|ksh|fish)/ { print $1 }
' | while read -r pane_id; do
# renew environment variables according to update-environment tmux option
# also clear screen
tmux send-keys -t "$pane_id" 'Enter' 'eval "$(tmux show-env -s)"' 'Enter' 'C-l'
done;

View file

@ -0,0 +1,384 @@
# ==========================
# === General settings ===
# ==========================
set -g default-terminal "screen-256color"
set -g history-limit 20000
set -g buffer-limit 20
set -sg escape-time 0
set -g display-time 1500
set -g remain-on-exit off
set -g repeat-time 300
setw -g allow-rename off
setw -g automatic-rename off
setw -g aggressive-resize on
# Change prefix key to C-a, easier to type, same to "screen"
unbind C-b
set -g prefix C-a
# Set parent terminal title to reflect current window in tmux session
set -g set-titles on
set -g set-titles-string "#I:#W"
# Start index of window/pane with 1, because we're humans, not computers
set -g base-index 1
setw -g pane-base-index 1
# Enable mouse support
set -g mouse on
# ==========================
# === Key bindings ===
# ==========================
# Unbind default key bindings, we're going to override
unbind "\$" # rename-session
unbind , # rename-window
unbind % # split-window -h
unbind '"' # split-window
unbind } # swap-pane -D
unbind { # swap-pane -U
unbind [ # paste-buffer
unbind ]
unbind "'" # select-window
unbind n # next-window
unbind p # previous-window
unbind l # last-window
unbind M-n # next window with alert
unbind M-p # next window with alert
unbind o # focus thru panes
unbind & # kill-window
unbind "#" # list-buffer
unbind = # choose-buffer
unbind z # zoom-pane
unbind M-Up # resize 5 rows up
unbind M-Down # resize 5 rows down
unbind M-Right # resize 5 rows right
unbind M-Left # resize 5 rows left
# Edit configuration and reload
bind C-e new-window -n 'tmux.conf' "sh -c '\${EDITOR:-vim} ~/.tmux.conf && tmux source ~/.tmux.conf && tmux display \"Config reloaded\"'"
# Reload tmux configuration
bind C-r source-file ~/.tmux.conf \; display "Config reloaded"
# new window and retain cwd
bind c new-window -c "#{pane_current_path}"
# Prompt to rename window right after it's created
set-hook -g after-new-window 'command-prompt -I "#{window_name}" "rename-window '%%'"'
# Rename session and window
bind r command-prompt -I "#{window_name}" "rename-window '%%'"
bind R command-prompt -I "#{session_name}" "rename-session '%%'"
# Split panes
bind | split-window -h -c "#{pane_current_path}"
bind _ split-window -v -c "#{pane_current_path}"
# Select pane and windows
bind -r C-[ previous-window
bind -r C-] next-window
bind -r [ select-pane -t :.-
bind -r ] select-pane -t :.+
bind -r Tab last-window # cycle thru MRU tabs
bind -r C-o swap-pane -D
# Zoom pane
bind + resize-pane -Z
# Link window
bind L command-prompt -p "Link window from (session:window): " "link-window -s %% -a"
# Swap panes back and forth with 1st pane
# When in main-(horizontal|vertical) layouts, the biggest/widest panel is always @1
bind \ if '[ #{pane_index} -eq 1 ]' \
'swap-pane -s "!"' \
'select-pane -t:.1 ; swap-pane -d -t 1 -s "!"'
# Kill pane/window/session shortcuts
bind x kill-pane
bind X kill-window
bind C-x confirm-before -p "kill other windows? (y/n)" "kill-window -a"
bind Q confirm-before -p "kill-session #S? (y/n)" kill-session
# Merge session with another one (e.g. move all windows)
# If you use adhoc 1-window sessions, and you want to preserve session upon exit
# but don't want to create a lot of small unnamed 1-window sessions around
# move all windows from current session to main named one (dev, work, etc)
bind C-u command-prompt -p "Session to merge with: " \
"run-shell 'yes | head -n #{session_windows} | xargs -I {} -n 1 tmux movew -t %%'"
# Detach from session
bind d detach
bind D if -F '#{session_many_attached}' \
'confirm-before -p "Detach other clients? (y/n)" "detach -a"' \
'display "Session has only 1 client attached"'
# Hide status bar on demand
bind C-s if -F '#{s/off//:status}' 'set status off' 'set status on'
# ==================================================
# === Window monitoring for activity and silence ===
# ==================================================
bind m setw monitor-activity \; display-message 'Monitor window activity [#{?monitor-activity,ON,OFF}]'
bind M if -F '#{monitor-silence}' \
'setw monitor-silence 0 ; display-message "Monitor window silence [OFF]"' \
'command-prompt -p "Monitor silence: interval (s)" "setw monitor-silence %%"'
# Activity bell and whistles
set -g visual-activity on
# TODO: Does not work as well, check on newer versions
# set -g visual-silence on
# BUG: bell-action other ignored · Issue #1027 · tmux/tmux · GitHub - https://github.com/tmux/tmux/issues/1027
# set -g visual-bell on
# setw -g bell-action other
# ================================================
# === Copy mode, scroll and clipboard ===
# ================================================
set -g @copy_use_osc52_fallback on
# Prefer vi style key table
setw -g mode-keys vi
bind p paste-buffer
bind C-p choose-buffer
# trigger copy mode by
bind -n M-Up copy-mode
# Scroll up/down by 1 line, half screen, whole screen
bind -T copy-mode-vi M-Up send-keys -X scroll-up
bind -T copy-mode-vi M-Down send-keys -X scroll-down
bind -T copy-mode-vi M-PageUp send-keys -X halfpage-up
bind -T copy-mode-vi M-PageDown send-keys -X halfpage-down
bind -T copy-mode-vi PageDown send-keys -X page-down
bind -T copy-mode-vi PageUp send-keys -X page-up
# When scrolling with mouse wheel, reduce number of scrolled rows per tick to "2" (default is 5)
bind -T copy-mode-vi WheelUpPane select-pane \; send-keys -X -N 2 scroll-up
bind -T copy-mode-vi WheelDownPane select-pane \; send-keys -X -N 2 scroll-down
# wrap default shell in reattach-to-user-namespace if available
# there is some hack with `exec & reattach`, credits to "https://github.com/gpakosz/.tmux"
# don't really understand how it works, but at least window are not renamed to "reattach-to-user-namespace"
if -b "command -v reattach-to-user-namespace > /dev/null 2>&1" \
"run 'tmux set -g default-command \"exec $(tmux show -gv default-shell) 2>/dev/null & reattach-to-user-namespace -l $(tmux show -gv default-shell)\"'"
yank="~/.tmux/yank.sh"
# Copy selected text
bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "$yank"
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "$yank"
bind -T copy-mode-vi Y send-keys -X copy-line \;\
run "tmux save-buffer - | $yank"
bind-key -T copy-mode-vi D send-keys -X copy-end-of-line \;\
run "tmux save-buffer - | $yank"
bind -T copy-mode-vi C-j send-keys -X copy-pipe-and-cancel "$yank"
bind-key -T copy-mode-vi A send-keys -X append-selection-and-cancel \;\
run "tmux save-buffer - | $yank"
# Copy selection on drag end event, but do not cancel copy mode and do not clear selection
# clear select on subsequence mouse click
bind -T copy-mode-vi MouseDragEnd1Pane \
send-keys -X copy-pipe "$yank"
bind -T copy-mode-vi MouseDown1Pane select-pane \;\
send-keys -X clear-selection
# iTerm2 works with clipboard out of the box, set-clipboard already set to "external"
# tmux show-options -g -s set-clipboard
# set-clipboard on|external
# =====================================
# === Theme ===
# =====================================
# Feel free to NOT use this variables at all (remove, rename)
# this are named colors, just for convenience
color_orange="colour166" # 208, 166
color_purple="colour134" # 135, 134
color_green="colour076" # 070
color_blue="colour39"
color_yellow="colour220"
color_red="colour160"
color_black="colour232"
color_white="white" # 015
# This is a theme CONTRACT, you are required to define variables below
# Change values, but not remove/rename variables itself
color_dark="$color_black"
color_light="$color_white"
color_session_text="$color_blue"
color_status_text="colour245"
color_main="$color_orange"
color_secondary="$color_purple"
color_level_ok="$color_green"
color_level_warn="$color_yellow"
color_level_stress="$color_red"
color_window_off_indicator="colour088"
color_window_off_status_bg="colour238"
color_window_off_status_current_bg="colour254"
# =====================================
# === Appearence and status bar ===
# ======================================
set -g mode-style "fg=default,bg=$color_main"
# command line style
set -g message-style "fg=$color_main,bg=$color_dark"
# status line style
set -g status-style "fg=$color_status_text,bg=$color_dark"
# window segments in status line
set -g window-status-separator ""
separator_powerline_left=""
separator_powerline_right=""
# setw -g window-status-style "fg=$color_status_text,bg=$color_dark"
setw -g window-status-format " #I:#W "
setw -g window-status-current-style "fg=$color_light,bold,bg=$color_main"
setw -g window-status-current-format "#[fg=$color_dark,bg=$color_main]$separator_powerline_right#[default] #I:#W# #[fg=$color_main,bg=$color_dark]$separator_powerline_right#[default]"
# when window has monitoring notification
setw -g window-status-activity-style "fg=$color_main"
# outline for active pane
setw -g pane-active-border-style "fg=$color_main"
# general status bar settings
set -g status on
set -g status-interval 5
set -g status-position top
set -g status-justify left
set -g status-right-length 100
# define widgets we're going to use in status bar
# note, that this is not the complete list, some of them are loaded from plugins
wg_session="#[fg=$color_session_text] #S #[default]"
wg_battery="#{battery_status_fg} #{battery_icon} #{battery_percentage}"
wg_date="#[fg=$color_secondary]%h %d %H:%M#[default]"
wg_user_host="#[fg=$color_secondary]#(whoami)#[default]@#H"
wg_is_zoomed="#[fg=$color_dark,bg=$color_secondary]#{?window_zoomed_flag,[Z],}#[default]"
# TODO: highlighted for nested local session as well
wg_is_keys_off="#[fg=$color_light,bg=$color_window_off_indicator]#([ $(tmux show-option -qv key-table) = 'off' ] && echo 'OFF')#[default]"
set -g status-left "$wg_session"
set -g status-right "#{prefix_highlight} $wg_is_keys_off $wg_is_zoomed #{sysstat_cpu} | #{sysstat_mem} | #{sysstat_loadavg} | $wg_user_host | $wg_date $wg_battery #{online_status}"
# online and offline icon for tmux-online-status
set -g @online_icon "#[fg=$color_level_ok]●#[default]"
set -g @offline_icon "#[fg=$color_level_stress]●#[default]"
# Configure view templates for tmux-plugin-sysstat "MEM" and "CPU" widget
set -g @sysstat_mem_view_tmpl 'MEM:#[fg=#{mem.color}]#{mem.pused}#[default] #{mem.used}'
# Configure colors for tmux-plugin-sysstat "MEM" and "CPU" widget
set -g @sysstat_cpu_color_low "$color_level_ok"
set -g @sysstat_cpu_color_medium "$color_level_warn"
set -g @sysstat_cpu_color_stress "$color_level_stress"
set -g @sysstat_mem_color_low "$color_level_ok"
set -g @sysstat_mem_color_medium "$color_level_warn"
set -g @sysstat_mem_color_stress "$color_level_stress"
set -g @sysstat_swap_color_low "$color_level_ok"
set -g @sysstat_swap_color_medium "$color_level_warn"
set -g @sysstat_swap_color_stress "$color_level_stress"
# Configure tmux-battery widget colors
set -g @batt_color_full_charge "#[fg=$color_level_ok]"
set -g @batt_color_high_charge "#[fg=$color_level_ok]"
set -g @batt_color_medium_charge "#[fg=$color_level_warn]"
set -g @batt_color_low_charge "#[fg=$color_level_stress]"
# Configure tmux-prefix-highlight colors
set -g @prefix_highlight_output_prefix '['
set -g @prefix_highlight_output_suffix ']'
set -g @prefix_highlight_fg "$color_dark"
set -g @prefix_highlight_bg "$color_secondary"
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_copy_mode_attr "fg=$color_dark,bg=$color_secondary"
# =====================================
# === Renew environment ===
# =====================================
set -g update-environment \
"DISPLAY\
SSH_ASKPASS\
SSH_AUTH_SOCK\
SSH_AGENT_PID\
SSH_CONNECTION\
SSH_TTY\
WINDOWID\
XAUTHORITY"
bind '$' run "~/.tmux/renew_env.sh"
# ============================
# === Plugins ===
# ============================
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-battery'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'tmux-plugins/tmux-online-status'
set -g @plugin 'tmux-plugins/tmux-sidebar'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'samoshkin/tmux-plugin-sysstat'
# Plugin properties
set -g @sidebar-tree 't'
set -g @sidebar-tree-focus 'T'
set -g @sidebar-tree-command 'tree -C'
set -g @open-S 'https://www.google.com/search?q='
# ==============================================
# === Nesting local and remote sessions ===
# ==============================================
# Session is considered to be remote when we ssh into host
if-shell 'test -n "$SSH_CLIENT"' \
'source-file ~/.tmux/tmux.remote.conf'
# We want to have single prefix key "C-a", usable both for local and remote session
# we don't want to "C-a" + "a" approach either
# Idea is to turn off all key bindings and prefix handling on local session,
# so that all keystrokes are passed to inner/remote session
# see: toggle on/off all keybindings · Issue #237 · tmux/tmux - https://github.com/tmux/tmux/issues/237
# Also, change some visual styles when window keys are off
bind -T root F12 \
set prefix None \;\
set key-table off \;\
set status-style "fg=$color_status_text,bg=$color_window_off_status_bg" \;\
set window-status-current-format "#[fg=$color_window_off_status_bg,bg=$color_window_off_status_current_bg]$separator_powerline_right#[default] #I:#W# #[fg=$color_window_off_status_current_bg,bg=$color_window_off_status_bg]$separator_powerline_right#[default]" \;\
set window-status-current-style "fg=$color_dark,bold,bg=$color_window_off_status_current_bg" \;\
if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\
refresh-client -S \;\
bind -T off F12 \
set -u prefix \;\
set -u key-table \;\
set -u status-style \;\
set -u window-status-current-style \;\
set -u window-status-current-format \;\
refresh-client -S
# Run all plugins' scripts
run '~/.tmux/plugins/tpm/tpm'

View file

@ -0,0 +1,10 @@
# show status bar at bottom for remote session,
# so it do not stack together with local session's one
set -g status-position bottom
# Set port of SSH remote tunnel, where tmux will pipe buffers to transfer on local machine for copy
set -g @copy_backend_remote_tunnel_port 11988
# In remote mode we don't show "clock" and "battery status" widgets
set -g status-left "$wg_session"
set -g status-right "#{prefix_highlight} $wg_is_keys_off $wg_is_zoomed #{sysstat_cpu} | #{sysstat_mem} | #{sysstat_loadavg} | $wg_user_host | #{online_status}"

68
tmux/tmux-config/tmux/yank.sh Executable file
View file

@ -0,0 +1,68 @@
#!/usr/bin/env bash
set -eu
is_app_installed() {
type "$1" &>/dev/null
}
# get data either form stdin or from file
buf=$(cat "$@")
copy_backend_remote_tunnel_port=$(tmux show-option -gvq "@copy_backend_remote_tunnel_port")
copy_use_osc52_fallback=$(tmux show-option -gvq "@copy_use_osc52_fallback")
# Resolve copy backend: pbcopy (OSX), reattach-to-user-namespace (OSX), xclip/xsel (Linux)
copy_backend=""
if is_app_installed pbcopy; then
copy_backend="pbcopy"
elif is_app_installed reattach-to-user-namespace; then
copy_backend="reattach-to-user-namespace pbcopy"
elif [ -n "${DISPLAY-}" ] && is_app_installed xsel; then
copy_backend="xsel -i --clipboard"
elif [ -n "${DISPLAY-}" ] && is_app_installed xclip; then
copy_backend="xclip -i -f -selection primary | xclip -i -selection clipboard"
elif [ -n "${copy_backend_remote_tunnel_port-}" ] \
&& (netstat -f inet -nl 2>/dev/null || netstat -4 -nl 2>/dev/null) \
| grep -q "[.:]$copy_backend_remote_tunnel_port"; then
copy_backend="nc localhost $copy_backend_remote_tunnel_port"
fi
# if copy backend is resolved, copy and exit
if [ -n "$copy_backend" ]; then
printf "%s" "$buf" | eval "$copy_backend"
exit;
fi
# If no copy backends were eligible, decide to fallback to OSC 52 escape sequences
# Note, most terminals do not handle OSC
if [ "$copy_use_osc52_fallback" == "off" ]; then
exit;
fi
# Copy via OSC 52 ANSI escape sequence to controlling terminal
buflen=$( printf %s "$buf" | wc -c )
# https://sunaku.github.io/tmux-yank-osc52.html
# The maximum length of an OSC 52 escape sequence is 100_000 bytes, of which
# 7 bytes are occupied by a "\033]52;c;" header, 1 byte by a "\a" footer, and
# 99_992 bytes by the base64-encoded result of 74_994 bytes of copyable text
maxlen=74994
# warn if exceeds maxlen
if [ "$buflen" -gt "$maxlen" ]; then
printf "input is %d bytes too long" "$(( buflen - maxlen ))" >&2
fi
# build up OSC 52 ANSI escape sequence
esc="\033]52;c;$( printf %s "$buf" | head -c $maxlen | base64 | tr -d '\r\n' )\a"
esc="\033Ptmux;\033$esc\033\\"
# resolve target terminal to send escape sequence
# if we are on remote machine, send directly to SSH_TTY to transport escape sequence
# to terminal on local machine, so data lands in clipboard on our local machine
pane_active_tty=$(tmux list-panes -F "#{pane_active} #{pane_tty}" | awk '$1=="1" { print $2 }')
target_tty="${SSH_TTY:-$pane_active_tty}"
printf "$esc" > "$target_tty"

77
tmux/tmux.conf Normal file
View file

@ -0,0 +1,77 @@
# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
# History
set -g history-limit 10000
# Terminal emulator window title
set -g set-titles on
set -g set-titles-string '[#S:#I.#H] #W'
# Status Bar
set-option -g status-bg white
set-option -g status-fg black
# Notifying if other windows has activities
setw -g monitor-activity off
set -g visual-activity on
# Clock
setw -g clock-mode-colour green
setw -g clock-mode-style 24
# make scrolling with wheels work
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
# Mouse Support
setw -g mouse
# Add SSH_TTY to the list of environment variables tmux knows about:
set-option -g update-environment "DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY SSH_TTY"
# Assume terminals want 256 colors
set-option -g default-terminal screen-256color
# Colors
# Status bar has a dim gray background
set-option -g status-bg black
set-option -g status-fg colour74
# Left shows the session name, in blue
set-option -g status-left-bg default
set-option -g status-left-fg colour74
# Right is some CPU stats, so terminal green
set-option -g status-right-bg default
set-option -g status-right-fg black
set -g status-right "Impossible is a State of Mind"
# statusbar
set -g status-position bottom
set -g status-justify left
set -g status-style 'bg=colour219 fg=colour137'
set -g status-left '#[fg=colour233,bg=colour219] %d/%m #[fg=colour233,bg=colour8] %H:%M:%S '
set -g status-right-length 50
set -g status-left-length 20
setw -g window-status-current-style 'fg=colour1 bg=colour219 bold'
setw -g window-status-current-format ' #I#[fg=colour249]:#[fg=colour255]#W#[fg=colour249]#F '
setw -g window-status-style 'fg=colour9 bg=colour219'
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '
setw -g window-status-bell-style 'fg=colour255 bg=colour1 bold'
# Highlighting the active window in status bar
setw -g window-status-current-bg colour234
setw -g window-status-current-fg colour71
# zsh
set-option -g default-shell ${SHELL}
set-option -g default-shell /bin/zsh
new-session

View file

@ -0,0 +1,88 @@
#!/bin/bash
# Post-installation bash script for Ubuntu
tabs 4
TITLE="Ubuntu Post-Install Script"
function main {
echo_message header "Starting 'main' function"
# Draw window
MAIN=$(eval `resize` && whiptail \
--notags \
--title "$TITLE" \
--menu "\nWhat would you like to do?" \
--cancel-button "Quit" \
$LINES $COLUMNS $(( $LINES - 12 )) \
'system_update' 'Perform system updates' \
'install_favs' 'Install preferred applications' \
'install_favs_dev' 'Install preferred development tools' \
'install_favs_utils' 'Install preferred utilities' \
'install_gnome' 'Install preferred GNOME software' \
'install_codecs' 'Install multimedia codecs' \
'install_fonts' 'Install additional fonts' \
'install_snap_apps' 'Install Snap applications' \
'install_flatpak_apps' 'Install Flatpak applications' \
'install_thirdparty' 'Install third-party applications' \
'setup_dotfiles' 'Configure dotfiles' \
'system_configure' 'Configure system' \
'system_cleanup' 'Cleanup the system' \
3>&1 1>&2 2>&3)
# check exit status
if [ $? = 0 ]; then
echo_message header "Starting '$MAIN' function"
$MAIN
else
# Quit
quit
fi
}
# Quit
function quit {
echo_message header "Starting 'quit' function"
echo_message title "Exiting $TITLE..."
# Draw window
if (whiptail --title "Quit" --yesno "Are you sure you want quit?" 8 56) then
echo_message welcome 'Thanks for using!'
exit 99
else
main
fi
}
# Import Functions
function import_functions {
DIR="functions"
# iterate through the files in the 'functions' folder
for FUNCTION in $(dirname "$0")/$DIR/*; do
# skip directories
if [[ -d $FUNCTION ]]; then
continue
# exclude markdown readmes
elif [[ $FUNCTION == *.md ]]; then
continue
elif [[ -f $FUNCTION ]]; then
# source the function file
. $FUNCTION
fi
done
}
# Import main functions
import_functions
# Welcome message
echo_message welcome "$TITLE"
# Run system checks
system_checks
# main
while :
do
main
done

3
vim/.netrwhist Normal file
View file

@ -0,0 +1,3 @@
let g:netrw_dirhistmax =10
let g:netrw_dirhist_cnt =1
let g:netrw_dirhist_1='/Users/mia/Projects/blog/blog/output/author'

View file

@ -0,0 +1,4 @@
let g:netrw_dirhistmax =10
let g:netrw_dirhist_cnt =2
let g:netrw_dirhist_1='/Users/mia/Projects/THREAT_INTEL/threat_intel/threat_intel/util'
let g:netrw_dirhist_2='/Users/mia/Projects/security-tools'

1
vpn/README.md Normal file
View file

@ -0,0 +1 @@
# Cloud Scripts

View file

@ -0,0 +1,41 @@
#!/bin/bash
# This scripts creates PKI secrets
# Author: Mia Stein
DOMAIN=
ACM_ENV=
ACM_DIR=~/.acm_secrets
LOCAL_DIR=$(pwd)
git clone https://github.com/OpenVPN/easy-rsa.git && cd easy-rsa/easyrsa3
# Create PKI
./easyrsa init-pki
# Generates the CA certificate without a password
yes | ./easyrsa build-ca nopass
# Build server certificate without a password
./easyrsa build-server-full server"$DOMAIN" nopass
# Build client certificate without a password
./easyrsa build-client-full client"$DOMAIN" nopass
# Copy certificate files to a new directory
if [ -d "$ACM_DIR" ]
then
echo Info: directory "$ACM_DIR" exists.
else
mkdir "$ACM_DIR"
fi
cp "$LOCAL_DIR"/easy-rsa/easyrsa3/pki/ca.crt "$ACM_DIR"/"$ACM_ENV"_ca.crt
cp "$LOCAL_DIR"/easy-rsa/easyrsa3/pki/issued/*.crt "$ACM_DIR"
cp "$LOCAL_DIR"/easy-rsa/easyrsa3/pki/private/*.key "$ACM_DIR"
echo Info: Certificates and keys were generate in "$ACM_DIR"
# Clean up
cd "$LOCAL_DIR"
rm -rf "$LOCAL_DIR"/easy-rsa

30
vpn/push_vpn_pki_resources.sh Executable file
View file

@ -0,0 +1,30 @@
#!/bin/bash
# This script pushes PKI certs to AWS ACM.
# Author: Mia Stein
ACM_ENV=
DOMAIN=
AWS_REGION=
ACM_DIR=~/.acm_secrets
CLIENT_KEY="$ACM_DIR"/client"$DOMAIN".key
CLIENT_CERT="$ACM_DIR"/client"$DOMAIN".crt
SERVER_KEY="$ACM_DIR"/server"$DOMAIN".key
SERVER_CERT="$ACM_DIR"/server"$DOMAIN".crt
CA_CERTIFICATE="$ACM_DIR"/"$ACM_ENV"_ca.crt
echo "Pushing client certificate and key to ACM..."
CLIENT_CERT_ARN=`aws acm import-certificate --certificate file://"$CLIENT_CERT" --private-key file://"$CLIENT_KEY" --certificate-chain file://"$CA_CERTIFICATE" --region "$AWS_REGION" | jq '.CertificateArn'
echo "Successfully pushed client certificate with ARN "$CLIENT_CERT_ARN
echo "Pushing server certificate and key to ACM..."
SERVER_CERT_ARN=`aws acm import-certificate --certificate file://"$SERVER_CERT" --private-key file://"$SERVER_KEY" --certificate-chain file://"$CA_CERTIFICATE" --region "$AWS_REGION" | jq '.CertificateArn'
echo "Successfully pushed client certificate with ARN "$SERVER_CERT_ARN

36
vscode/README.md Normal file
View file

@ -0,0 +1,36 @@
# Vscode plugins
* Auto Import
* Code Spell Checker
* Debugger for Chrome
* Docker
* Document This
* EditorConfig
* ESLint
* GitLens
* GraphQL
* JavaScript (ES6) Code Snippets
* Jest Snippets Standard Style
* npm
* npm Intellisense
* Prettier
* Prettify Selected JSON
* Promise Snippets
* ReactJS Code Snippets
* Remark
* Simple React Snippets
* Commitizen Support
* styled-components
## Useful Shortcuts
* Open the terminal with:
```
^`
```
* add this alias to your shell profile (e.g. `~/.zshrc`):
```
alias code="open -a 'Visual Studio Code'"
```

3
zsh/README.md Normal file
View file

@ -0,0 +1,3 @@
## zsh
* [spaceship plugin](https://github.com/denysdovhan/spaceship-prompt).

47
zsh/zshrc Normal file
View file

@ -0,0 +1,47 @@
###########
# Exports
###########
export PATH="$HOME/go/bin/:$PATH"
export GOPATH=$HOME/go
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
export KUBECONFIG=~/.kube/config
export KUBECTX_CURRENT_FGCOLOR=$(tput setaf 3)
export KUBECTX_CURRENT_BGCOLOR=$(tput setab 5)
export HISTCONTROL=ignoredups
export CLICOLOR=230
export GREP_COLOR='1;31' # green for matches
export GREP_OPTIONS='--color=auto'
export ZSH="/Users/mia/.oh-my-zsh"
ZSH_THEME="robbyrussell"
###########
# PLUGINS ✨
############
plugins=(git)
source $ZSH/oh-my-zsh.sh
##########
# ALIAS ✨
##########
alias fly="/usr/local/opt/fly"
alias zshconfig="mate ~/.zshrc"
alias ohmyzsh="mate ~/.oh-my-zsh"
alias code="open -a 'Visual Studio Code'"
alias gc="git commit"
alias ga="git add"
alias gp="git push"
alias gp="git pull"
alias k="kubectl"