This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Customizing your shell prompt | |
Shell prompts are extremely customizable. You can customize them in two ways: (1) by using command characters that print out special things and (2) by using colors. Also, customizing the prompt is different in different shells; I'm going to cover tcsh and zsh here. bash is the other popular shell, but I think it sucks, and I never use it, so I'm not going to waste any time on it. | |
tcsh | |
zsh | |
tcsh | |
I'll start with tcsh, since it's the default BSD and Mac OS X shell. Here's a very simple prompt: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: nginx-deployment | |
labels: | |
app: nginx | |
spec: | |
replicas: 3 | |
selector: | |
matchLabels: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: rbac.authorization.k8s.io/v1 | |
kind: ClusterRole | |
metadata: | |
name: system:aggregated-metrics-reader | |
labels: | |
rbac.authorization.k8s.io/aggregate-to-view: "true" | |
rbac.authorization.k8s.io/aggregate-to-edit: "true" | |
rbac.authorization.k8s.io/aggregate-to-admin: "true" | |
rules: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat /var/log/messages | grep error | awk '{print $1,$2,$3}' | uniq -c | sort -nr | head -n 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Getting list of Availability Zones" | |
all_regions=$(aws ec2 describe-regions --output text --query 'Regions[*].[RegionName]' | sort) | |
all_az=() | |
while read -r region; do | |
az_per_region=$(aws ec2 describe-availability-zones --region $region --query 'AvailabilityZones[*].[ZoneName]' --output text | sort) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aws ec2 run-instances --image-id ami-088dbc54f17f8a1a2 --count 1 --instance-type t3.large --key-name mysshey --subnet-id subnet-XXXXXXXXXXXXXXXXX --iam-instance-profile Name=ecsInstanceRole --security-group-ids sg-XXXXXXXXXXXXXXXXX --user-data file://ecs.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vi /etc/audit/audit.rules | |
# Referenced from https://www.thegeekdiary.com/audit-rules-for-monitoring-copy-move-delete-and-kill-commands-in-linux/ | |
# | |
# Audit Copy, Move, Delete & Create file commands | |
-a exit,always -F arch=b64 -S execve -F path=/bin/cp -k Copy | |
-a exit,always -F arch=b64 -S execve -F path=/bin/mv -k Move_Rename | |
-a exit,always -F arch=b64 -S execve -F path=/bin/rm -k Delete | |
-a exit,always -F arch=b64 -S execve -F path=/bin/vi -k Create_Edit_View_File | |
# Audit shutdown & Reboot command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while true; do date; curl -so /dev/null -w"\nSource IP:\t\t%{local_ip}:%{local_port}\nDest IP:\t\t%{remote_ip}:%{remote_port}\nHTTP Version:\t\t%{http_version}\nHTTP Status Code:\t%{http_code}\nEffective URL:\t\t%{url_effective}\nRedirect URL:\t\t%{redirect_url}\nNum of Redirects:\t%{num_redirects}\nNum of Connects:\t%{num_connects}\nDownload Size:\t\t%{size_download} bytes\nSSL Verify Result:\t%{ssl_verify_result}\nDNS Resolution Time:\t%{time_namelookup}\nTCP Handshake Time:\t%{time_connect}\nSSL Handshake Time:\t%{time_appconnect}\nPre Transfer Time:\t%{time_pretransfer}\nStart Transfer Time:\t%{time_starttransfer}\nTotal Time Spent:\t%{time_total}\n==========================================\n\n" $1; sleep 5; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CLUSTER=ecs-fargate-spot-only | |
ECS_SERVICE_NAME=ecs-fargate-hybrid | |
TASK_ARNS=$(aws ecs list-tasks --cluster $CLUSTER --service-name $ECS_SERVICE_NAME) | |
TASK_ARNS_STRING=$(echo $TASK_ARNS | jq --raw-output .taskArns[]) | |
# echo $TASK_ARNS_STRING | |
# aws ecs describe-tasks --cluster ecs-fargate-spot-only --tasks $TASK_ARNS_STRING | grep capacityProviderName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ECS_CLUSTER=ecs-playground | |
ECS_ENABLE_CONTAINER_METADATA=true | |
ECS_RESERVED_MEMORY=256 | |
ECS_ENABLE_TASK_IAM_ROLE=true | |
ECS_INSTANCE_ATTRIBUTES={"custom_attribute": "value_is_one"} |
NewerOlder