Skip to content

Instantly share code, notes, and snippets.

View asolera's full-sized avatar

Andrew Solera asolera

  • Secretaria Municipal de Direitos Humanos e Cidadania
  • São Paulo
View GitHub Profile
@asolera
asolera / git-fetch-branches.sh
Last active April 7, 2021 18:46
Git fetch all remote branches to local machine
#!/bin/bash
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
@asolera
asolera / .env
Last active April 12, 2021 14:53
Vagrant with dot env without plugins
EXAMPLE_ENV_A=Hello
EXAMPLE_ENV_B=world
@asolera
asolera / cloudformation.yml
Created April 14, 2021 14:28
AWS CloudFormation Template for EC2 (AMI) with Docker
AWSTemplateFormatVersion: '2010-09-09'
Description: AWS CloudFormation Template for EC2 (AMI) with Docker
Parameters:
EC2AvailabilityZoneParam:
Type: String
Default: us-east-1a
EC2ImageNameParam:
Type: String
Default: ami-0533f2ba8a1995cf9
@asolera
asolera / docker-debug.sh
Created April 16, 2021 18:00
Docker swarm debug commands that shows errors on service deploy
#!/bin/bash
# Credits/thanks to: https://stackoverflow.com/questions/45372848/docker-swarm-how-to-find-out-why-service-cant-start
docker service ps --no-trunc {serviceName}
journalctl -u docker.service | tail -n 50
@asolera
asolera / fix-crlf.sh
Created April 23, 2021 18:32
Fix CRLF git problems
#!/bin/bash
# https://stackoverflow.com/questions/1967370/git-replacing-lf-with-crlf
git config --global core.autocrlf false
git rm --cached -r .
git reset --hard
@asolera
asolera / README.md
Last active April 29, 2021 21:00
Traefik + Nginx without Docker on AWS - Amazon Linux 2 (AMI)

Traefik + Nginx without Docker on Amazon Linux 2 (AMI)

Guide on how to configure Traefik with Nginx on Amazon Linux 2 EC2 Instance, without Docker.

  1. Create an EC2 Instance on AWS with security groups allowing incoming traffic on ports 80 and 443.

  2. Connect to your instance.

  3. Install and configure Nginx:

@asolera
asolera / slimscroll.js
Created May 4, 2021 21:57
jQuery SlimScroll fix for window resize
function applySlimScroll() {
$('.slimScrollDiv .sidebar').unwrap();
$('.slimScrollBar, .slimScrollRail').remove();
$('.sidebar').slimScroll({
height: 'auto',
size: '10px',
color: #ff0000',
alwaysVisible: true,
railVisible: true,
railColor: '#222',
@asolera
asolera / README.md
Created May 31, 2021 22:17
WSO2 Conditional Redirecting Mediation Policy

This mediation policy redirects requests based on resource variable, but keeping limit and offset query params (ignore rest).

"Endpoint type" MUST be set to "Dynamic Endpoint" at "Implement" publisher tab.

@asolera
asolera / install.sh
Last active October 20, 2021 14:07
Installing AWS CloudAgent on Amazon Linux
#!/bin/sh
# Associate IAM profile (with role `CloudWatchAgentServerRole`) to your EC2 instance
# Install CloudWatch
sudo yum install amazon-cloudwatch-agent -y
# Install CollectD
sudo amazon-linux-extras install collectd -y
@asolera
asolera / show_simple_config.sh
Created November 1, 2021 16:08
Show simple config files
#!/bin/bash
cat file.conf | grep -v '#' | grep -ve '^$'