Skip to content

Instantly share code, notes, and snippets.

View filipeandre's full-sized avatar

Filipe Ferreira filipeandre

  • 07:53 (UTC +01:00)
View GitHub Profile
@CMCDragonkai
CMCDragonkai / Git CLI Recipes.md
Last active May 24, 2024 10:24
Git CLI Recipes #git

Git Recipes

Bring in a Remote Branch

git fetch <remote>
git checkout -b <branch> --track <remote>/<branch>
@gsanders5
gsanders5 / example.nginx
Last active August 18, 2022 06:20
Automatic nginx virtual subdomains with sub-folders or sub-directories
# Automatic nginx virtual subdomains with sub-folders or sub-directories
#
# Since the original source where I found this code is now offline, I have decided to mirror it here.
# All credit goes to: http://web.archive.org/web/20150307193208/http://www.messaliberty.com/2010/10/automatic-nginx-virtual-subdomains-with-sub-folders-or-sub-directories
#
# Description: In my web root directory I wanted create a folder called photos, and another called
# music using a sftp program. Without manually going back to the config file or to the shell I like to
# be able to access them at photos.nginxdomain.com and music.nginxdomain.com. That is what this config does.
# Redirect visitors from http://nginxdomain.com/ to http://www.nginxdomain.com/
@csonuryilmaz
csonuryilmaz / clone-mysql-db.sh
Last active May 17, 2024 12:12 — forked from christopher-hopper/clone-mysql-db.sh
Clone a MySQL database to a new database on the same server without using a dump file. This is much faster than using mysqldump.
#!/bin/bash
DBUSER="root";
DBPASS="";
DBHOST="localhost";
DB_OLD=mydatabase
DB_NEW=clone_mydatabase
DBCONN="--host=${DBHOST} --user=${DBUSER} --password=${DBPASS}";
@davidfrey
davidfrey / cfn-s3-queue-notification.yml
Created February 21, 2017 15:25
Cloud Formation: S3 Queue Notification
AWSTemplateFormatVersion: "2010-09-09"
Description: S3 Queue Notifications Test
Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
- Label:
default: Stack Variables
Parameters:
- Environment
- Label:
@g-a-d
g-a-d / gist:4bc7f716bc57e42b64e1ef450be9bae8
Created November 6, 2017 15:41
Converting CloudFormation parameter files to CodePipeline Template Configuration files
Using jq, we can convert between CloudFormation parameter files and CodePipeline template configuration files:
$ jq '{ Parameters: [ .[] | { (.ParameterKey): .ParameterValue } ] | add } ' < cloudformation_parameter_file.json
This is useful in the case of receiving 'Template configuration is not valid' when running a CloudFormation action.
A CloudFormation parameter file has format:
[
{
@GovardhanKanala
GovardhanKanala / master.md
Created November 22, 2017 01:13 — forked from gangsta/master.md
Install Consul Server on Centos 7
echo '
#! /bin/bash


####### yum update is optional #####
#yum -y update
yum install firewalld -y
systemctl start firewalld
firewall-cmd  --add-port=8300/tcp --add-port=8301/tcp --add-port=8302/tcp --add-port=8400/tcp --add-port=8500/tcp --add-port=80/tcp --add-port=443/tcp --permanent
@seansummers
seansummers / inventory-global.template.yml
Last active September 15, 2023 11:21
AWS Configuration Tracking
---
AWSTemplateFormatVersion: '2010-09-09'
Description: Global assets needed for Inventory Discovery
Metadata:
AWS::CloudFormation::Interface:
@hoangvx
hoangvx / schedule_rds.py
Created August 29, 2018 00:34
Create a lambda function for auto start and stop rds instance by add tags into instance. Then, schedule it by cloudwatch event
import boto3
import time
# Example RDS Instance tags:
#
# Scheduled : True
# ScheduleStart : 06:00
# ScheduleStop : 18:00
##
@ariesmcrae
ariesmcrae / resources.yaml
Last active March 19, 2024 20:01
Cloudformation AWS::Include parser is very strict. Must put quotes everywhere. Otherwise, you'll get "InvalidAttributeValue". Here's a correct example.
S3Bucket:
Type: "AWS::S3::Bucket"
Properties:
BucketName:
Fn::Sub: "${TagProduct}-${TagEnvironment}-${TagEnvironmentNumber}-audit-${AWS::AccountId}-${AWS::Region}"
NotificationConfiguration:
QueueConfigurations:
- Event: "s3:ObjectCreated:*"
Queue:
Fn::GetAtt: [ "ObjectCreatedQueueAudit", "Arn" ]
@14kw
14kw / AWSControlTowerBP-BASELINE-CLOUDTRAIL.yml
Created August 7, 2019 01:15
Control Tower created default CloudFormation StackSets
AWSTemplateFormatVersion: 2010-09-09
Description: Configure AWS CloudTrail
Parameters:
ManagedResourcePrefix:
Type: 'String'
Description: 'Prefix for the managed resources'
EnableLogFileValidation:
Type: String