Skip to content

Instantly share code, notes, and snippets.

View cfbarbero's full-sized avatar

Cris Barbero cfbarbero

View GitHub Profile
@cfbarbero
cfbarbero / networking.md
Created September 28, 2021 21:16
networking.md

List ipv4 routes

netstat -rn -f inet
@cfbarbero
cfbarbero / sleep5.sh
Created July 1, 2020 20:49
One line shell script to repeat forever
while true; do date; sleep 5; done

Website bucket policy allowing access from a specific IP address OR from account IAM

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicReadGetObject",
            "Effect": "Allow",
            "Principal": "*",
 "Action": "s3:GetObject",
@cfbarbero
cfbarbero / prometheus-userdata.sh.tpl
Created April 28, 2020 14:04
Sample ec2 userdatas
#!/bin/bash
sudo useradd --no-create-home --shell /bin/false prometheus
sudo mkdir /etc/prometheus
sudo mkdir /var/lib/prometheus
sudo chown prometheus:prometheus /etc/prometheus
sudo chown prometheus:prometheus /var/lib/prometheus
curl -LO https://github.com/prometheus/prometheus/releases/download/v2.6.0/prometheus-2.6.0.linux-amd64.tar.gz
tar xvf prometheus-2.6.0.linux-amd64.tar.gz
sudo cp prometheus-2.6.0.linux-amd64/prometheus /usr/local/bin/
sudo cp prometheus-2.6.0.linux-amd64/promtool /usr/local/bin/
@cfbarbero
cfbarbero / create-aws-orgaccessrole.sh
Last active February 7, 2020 17:21
Create the OrganizationAccountAccessRole using the AWS CLI
#!/bin/bash
if [ "$1" == "" ]; then
echo "Please set the ORGANIZATION ACCOUNT_ID as the first parameter"
fi
ACCOUNT_ID=$1
aws iam create-role --role-name OrganizationAccountAccessRole --assume-role-policy-document %7B%0A%20%20%22Version%22%3A%20%222012-10-17%22%2C%0A%20%20%22Statement%22%3A%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22Effect%22%3A%20%22Allow%22%2C%0A%20%20%20%20%20%20%22Principal%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22AWS%22%3A%20%22arn%3Aaws%3Aiam%3A%3A$ACCOUNT_ID%3Aroot%22%0A%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%22Action%22%3A%20%22sts%3AAssumeRole%22%0A%20%20%20%20%7D%0A%20%20%5D%0A%7D
aws iam attach-role-policy --policy-arn arn:aws:iam::aws:policy/AdministratorAccess --role-name OrganizationAccountAccessRole
  • gitolite - git ssh manager
# Reference: https://rehansaeed.com/gitattributes-best-practices/
###############################
# Git Line Endings #
###############################
# Set default behavior to automatically normalize line endings.
* text=auto
# Force bash scripts to always use lf line endings so that if a repo is accessed
1. pyenv
2. pipsi