Skip to content

Instantly share code, notes, and snippets.

@DanyC97
DanyC97 / nginx.conf
Created March 28, 2024 16:57 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@DanyC97
DanyC97 / CopyTags.yml
Created November 2, 2020 18:47 — forked from tomekklas/CopyTags.yml
Copy tags from EC2 to associated resources
---
AWSTemplateFormatVersion: 2010-09-09
Description: Copy tags from EC2 to associated resources
Resources:
Role:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
@DanyC97
DanyC97 / why.sh
Created July 25, 2020 16:09 — forked from xiongchiamiov/why.sh
Use this when Amazon gives you an "Encoded authorization failure message" and you need to turn it into something readable. If you only get a request id... you're out of luck.
function decode-authorization-failure-message {
if [ $# -ne 1 ] || [ "$1" = -h ] || [ "$1" = --help ]; then
cat <<'EOT'
Usage: decode-authorization-failure-message <message>
Use this when Amazon gives you an "Encoded authorization failure message" and
you need to turn it into something readable.
EOT
return 1
fi
@DanyC97
DanyC97 / gitcheats.txt
Created April 29, 2020 09:49 — forked from chrismccoy/gitcheats.txt
git cheats
# shortform git commands
alias g='git'
# pretty tab'd git log
git log --graph --pretty="tformat:%h*(%ar)*<%an>*%d %s" $* | sed -Ee 's/(^[^<]*) ago\)/\1)/' | sed -Ee 's/(^[^<]*), [[:digit:]]+ .*months?\)/\1)/' | column -s '*' -t | cat
# change author of all git repos
git filter-branch -f --env-filter "GIT_AUTHOR_NAME='yourname'; GIT_AUTHOR_EMAIL='[email protected]'; GIT_COMMITTER_NAME='yourname'; GIT_COMMITTER_EMAIL='[email protected]';" HEAD;
# stage only deleted files
@DanyC97
DanyC97 / Ansible CloudFormation Macros.md
Created April 17, 2019 11:29 — forked from jheller/Ansible CloudFormation Macros.md
Using Ansible/Jinja macros to generate CloudFormation templates

Generating CloudFormation Templates from YAML Dictionaries

The security group and Network ACLs parts of CloudFormation templates can be difficult to read. This template containing Jinja macros converts easier-to-read YAML dictionaries of security group and NACL rules into JSON.

Here ais a generic macro template and some example files showing how to use it.

  • cloudformation.macros.j2 - the macros
  • cf_vars.yml - YAML dictionaly of security groups and NACLs, including some complex rules for both
  • test.template.j2 - a simple CloudFormation template that uses the macro file
  • cf_test.yml - a simple Ansible playbook that generates CloudFormation JSON from thr previous file.
@DanyC97
DanyC97 / iterm2.md
Created September 27, 2018 05:57 — forked from squarism/iterm2.md
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
Fullscreen + Enter
Previous Tab + Left Arrow
Next Tab + Right Arrow
Go to Tab + Number
Go to Window + Option + Number
Go to Split Pane by Direction + Option + Arrow
@DanyC97
DanyC97 / README.md
Created September 24, 2018 11:06 — forked from kmassada/README.md
Vagrant and KVM(QEMU) on Centos7

Libvirt

yum group install -y "Development Tools"
yum -y install qemu-kvm libvirt virt-install bridge-utils libvirt-devel  libxslt-devel libxml2-devel libvirt-devel libguestfs-tools-c
echo "net.ipv4.ip_forward = 1"|sudo tee /etc/sysctl.d/99-ipforward.conf
sysctl -p /etc/sysctl.d/99-ipforward.conf
@DanyC97
DanyC97 / README.md
Created September 18, 2018 17:02 — forked from magnetikonline/README.md
AWS CloudFormation YAML template - appending to list parameter types.

AWS CloudFormation YAML template - appending to list parameter types

Documenting this here, as I often forget (what I have found) is the best way to do this at the moment.

For example, you have a list of two existing security groups given to a stack and wish to create (and use) a third - attaching all to an ALB:

AWSTemplateFormatVersion: "2010-09-09"
Description: "Example template"

Parameters:
@DanyC97
DanyC97 / ca.md
Created August 21, 2018 09:56 — forked from soarez/ca.md
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@DanyC97
DanyC97 / .docker-alias.bash
Created March 21, 2018 15:46 — forked from jverdeyen/.docker-alias.bash
A set of docker aliases
# ------------------------------------
# Docker alias and function
# ------------------------------------
# Get latest container ID
alias dl="docker ps -l -q"
# Get container process
alias dps="docker ps"