Skip to content

Instantly share code, notes, and snippets.

View asolera's full-sized avatar

Andrew Solera asolera

  • Secretaria Municipal de Inovação e Tecnologia de São Paulo
  • São Paulo
View GitHub Profile
@asolera
asolera / smtp
Created June 30, 2022 15:01
SMTP test using Telnet
View smtp
telnet 172.16.10.10 25
Trying 172.16.10.10...
Connected to 172.16.10.10.
Escape character is '^]'.
220 c1v41d.localdomain ESMTP Postfix
helo test.smtp
250 c1v41d.localdomain
mail from:<youremail@domain.com>
250 2.1.0 Ok
rcpt to:<youremail@domain.com>
@asolera
asolera / clone.sh
Created January 24, 2022 18:40
git clone ssh on different port
View clone.sh
#!/bin/bash
git clone ssh://git@<url>:<port>/path/to/repo.git
@asolera
asolera / table_size.sql
Created November 1, 2021 16:12
Show table size in PostgreSQL
View table_size.sql
SELECT pg_size_pretty(pg_relation_size('table_name'));
@asolera
asolera / dead_tuples.sql
Created November 1, 2021 16:11
Show dead tuples on PostgreSQL
View dead_tuples.sql
SELECT relname AS "table_name",
n_dead_tup AS "dead_tuples"
FROM pg_stat_user_tables;
@asolera
asolera / show_simple_config.sh
Created November 1, 2021 16:08
Show simple config files
View show_simple_config.sh
#!/bin/bash
cat file.conf | grep -v '#' | grep -ve '^$'
@asolera
asolera / install.sh
Last active October 20, 2021 14:07
Installing AWS CloudAgent on Amazon Linux
View install.sh
#!/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 / README.md
Created May 31, 2021 22:17
WSO2 Conditional Redirecting Mediation Policy
View README.md

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 / slimscroll.js
Created May 4, 2021 21:57
jQuery SlimScroll fix for window resize
View slimscroll.js
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
Last active April 29, 2021 21:00
Traefik + Nginx without Docker on AWS - Amazon Linux 2 (AMI)
View README.md

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 / fix-crlf.sh
Created April 23, 2021 18:32
Fix CRLF git problems
View fix-crlf.sh
#!/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