Skip to content

Instantly share code, notes, and snippets.

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 Jun 30, 2022
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 Jan 24, 2022
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 Nov 1, 2021
Show table size in PostgreSQL
View table_size.sql
SELECT pg_size_pretty(pg_relation_size('table_name'));
@asolera
asolera / dead_tuples.sql
Created Nov 1, 2021
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 Nov 1, 2021
Show simple config files
View show_simple_config.sh
#!/bin/bash
cat file.conf | grep -v '#' | grep -ve '^$'
@asolera
asolera / install.sh
Last active Oct 20, 2021
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
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
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 Apr 29, 2021
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 Apr 23, 2021
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