Skip to content

Instantly share code, notes, and snippets.

View goffinet's full-sized avatar

goffinet

View GitHub Profile
# Bash best practices and style-guide
Just simple methods to keep the code clean.
Inspired by [progrium/bashstyle](https://github.com/progrium/bashstyle) and [Kfir Lavi post](http://www.kfirlavi.com/blog/2012/11/14/defensive-bash-programming/).
## Quick big rules
* All code goes in a function
* Always double quote variables
@goffinet
goffinet / install-latest-compose.sh
Created September 12, 2020 17:28 — forked from deviantony/install-latest-compose.sh
Install latest version of Docker Compose
#!/bin/bash
# get latest docker compose released tag
COMPOSE_VERSION=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep 'tag_name' | cut -d\" -f4)
# Install docker-compose
sh -c "curl -L https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose"
chmod +x /usr/local/bin/docker-compose
sh -c "curl -L https://raw.githubusercontent.com/docker/compose/${COMPOSE_VERSION}/contrib/completion/bash/docker-compose > /etc/bash_completion.d/docker-compose"
@goffinet
goffinet / README.md
Created June 11, 2020 12:01 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


@goffinet
goffinet / gns3-duplicate-project.sh
Last active May 10, 2020 09:04
GNS3 Duplicate Project
#!/bin/bash
project="$1"
name="$2"
curl --location --request POST "http://172.16.253.1:3080/v2/projects/${project}/duplicate" \
--header 'Content-Type: application/json' \
--data-raw '{"name": "'"$name"'"}'
@goffinet
goffinet / quick-slugify.sh
Created February 14, 2020 06:55 — forked from oneohthree/quick-slugify.sh
Quick bash slugify
echo "$STRING" | iconv -t ascii//TRANSLIT | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z
@goffinet
goffinet / with2loop.yml
Created February 4, 2020 22:12 — forked from sivel/with2loop.yml
Ansible playbook showcasing conversion from with_X loops to loop using filters instead of lookup
---
- name: Playbook showcasing conversion from with_X loops to loop+filters
hosts: localhost
gather_facts: false
vars:
items:
-
- foo
-
- bar
@goffinet
goffinet / ansible-summary.md
Created January 20, 2020 12:53 — forked from andreicristianpetcu/ansible-summary.md
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of

@goffinet
goffinet / git-tag-delete-local-and-remote.sh
Created January 18, 2020 08:29 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@goffinet
goffinet / inventory
Created September 16, 2019 08:07 — forked from ezhulkov/inventory
[server]
SERVER
[server:vars]
server_name=SERVER
docker_nginx_ssl=true
#!/bin/bash
set -eu
if [ $# -lt 2 ] ; then
echo "Usage: $0 [--profile profile] [--region region] [--key key] [--filter filterkey] user host [port]"
exit
fi
while true; do