Skip to content

Instantly share code, notes, and snippets.

View dserodio's full-sized avatar
🐕

Daniel Serodio dserodio

🐕
View GitHub Profile
@dserodio
dserodio / README.md
Created September 24, 2018 21:06
Config. AWS PostgreSQL RDS to use pgbadger

Set the following properties in RDS:

log_min_duration_statement = 250
log_checkpoints = on
log_connections = on
log_disconnections = on
log_lock_waits = on
log_temp_files = 0
log_autovacuum_min_duration = 0
@dserodio
dserodio / history.sh
Last active January 11, 2023 13:34
Misc bash snippets
# Show timestamp for history output
export HISTTIMEFORMAT="%d/%m/%y %T "
@dserodio
dserodio / say.sh
Created November 12, 2018 16:36
Using Google Text to Speech (TTS) in Linux CLI
# gTTS (Google Text-to-Speech), a Python library and CLI tool to interface with Google Translate's text-to-speech API
# https://github.com/pndurette/gTTS
pipsi install gTTS
sudo apt install mpg123
say() {
gtts-cli "$@" | mpg123 -
}
@dserodio
dserodio / Dockerfile
Last active April 12, 2019 16:44
Dockerfile for multi-stage build of a Ruby app which needs Node at build time (credits: https://github.com/gomex)
# Dockerfile for a multi-stage build of a Ruby app which needs Node at build time
#
# Thanks to https://github.com/gomex for sharing
FROM ruby:2.5.1 as builder
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - &&\
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - &&\
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
"""Replace 'name' tag with 'Name' and 'application' with 'Application'
"""
import boto3
def uppercaseTagKeys(arn, name, application=None):
tags = {}
if name:
tags['Name'] = name
@dserodio
dserodio / test-psql-connectivity.sh
Last active April 7, 2020 22:37
Useful for testing downtime while applying modifications in RDS
while true; do
date -Isec | sed -e 's/+00:00//' | tr '\n' ' '
pg_isready -h YOUR_RDS_INSTANCE.rds.amazonaws.com -U USER -d DB_NAME
sleep 1
done | tee connection-test-$(date -Imin).log
@dserodio
dserodio / toggle_zero_columns.gs
Last active November 3, 2021 18:21
Hide Google Sheets columns with zeros
/*
* Usage: Tools > Script Editor
* replace all code with below
* Click Run
*
* Source: https://stackoverflow.com/a/13591754/31493
*/
function onOpen() {
// get active spreadsheet
@dserodio
dserodio / psql_check_ssl.sql
Created August 20, 2020 14:53
Check if PostgreSQL is using SSL
SELECT s.pid, s.ssl, s.version, a.client_addr, a.usename, a.datname, a.query
FROM pg_stat_ssl AS s
JOIN pg_stat_activity AS a ON a.pid = s.pid;
-- You can see `t|f` in `ssl` field
@dserodio
dserodio / ublock-filters.txt
Created May 28, 2021 13:31
uBlock Origin filters for blocking annoying push notification popups
!Source: https://www.reddit.com/r/brasil/comments/93zlgh/e_reclamam_do_adblock/e3ikvb9/
!
!Desabilitar notificações
||onesignal.com^
||pushcrew.com^
||widget.intercom.io^
||pushnews.eu^
! Block Pushnews (heavily abused by Exame, and other Brazilian media sites)
/pushnews-sw.js
@dserodio
dserodio / userChrome.css
Created June 10, 2021 20:48
Make Firefox bookmarks visible only on new tab page, like Chrome
/*
* Bookmarks toolbar is visible only on new tab page, just like Chrome.
*
* Screenshot: https://vimeo.com/235059188
* Video: https://vimeo.com/240436456
*
* Contributor(s): https://www.reddit.com/user/AJtfM7zT4tJdaZsm and Andrei Cristian Petcu
* https://www.reddit.com/r/FirefoxCSS/comments/7evwow/show_bookmarks_toolbar_only_on_new_tab/
*/