Skip to content

Instantly share code, notes, and snippets.

View dserodio's full-sized avatar
🐕

Daniel Serodio dserodio

🐕
View GitHub Profile
@dserodio
dserodio / route_add.sh
Last active May 22, 2017 20:15
Fix Docker Machine routes after connecting to VPN
sudo route -n add 192.168.99 -interface vboxnet0
@dserodio
dserodio / delete-all-slack-images.py
Last active March 28, 2018 20:35
Delete all images in Slack that were uploaded until yesterday
#!/usr/bin/env python
"""Delete all images in Slack that were uploaded until yesterday"""
import requests
import datetime
import sys
TOKEN = 'Put your Slack auth token here'
SLACK_API = 'https://slack.com/api'
@dserodio
dserodio / get-tags.sh
Created June 26, 2018 22:31
Get EC2 instance tags
# See https://stackoverflow.com/a/24549602/31493 and
# https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-tags.html
TAG_NAME="Name"
INSTANCE_ID=$(wget -qO- http://instance-data/latest/meta-data/instance-id)
REGION=$(wget -qO- http://instance-data/latest/meta-data/placement/availability-zone | sed -e 's:\([0-9][0-9]*\)[a-z]*\$:\\1:')
TAG_VALUE="`aws ec2 describe-tags --filters "Name=resource-id,Values=$INSTANCE_ID" "Name=key,Values=$TAG_NAME" --region $REGION --output=text | cut -f5`"
@dserodio
dserodio / snippets.sh
Last active July 23, 2018 13:24
apt and dpkg snippets
# which package owns a file
dpkg-query -S /path/to/file
# list files in an installed package
dpkg-query -L $PACKAGE
# list files in a deb file
dpkg-deb -c <package_name.deb>
# see also apt-file(1)
// https://github.com/isaacs/github/issues/514#issuecomment-408216389
Array.from(document.getElementsByClassName('js-details-target')).forEach(function(element){element.click()})
@dserodio
dserodio / dropdown.md
Created August 9, 2018 16:57 — forked from citrusui/dropdown.md
"Dropdowns" in Markdown
How do I dropdown?
This is how you dropdown.

<details>
<summary>How do I dropdown?</summary>
<br>
This is how you dropdown.
@dserodio
dserodio / tunnel.sh
Last active August 31, 2018 20:43 — forked from anonymous/gist:223853355d67123fdda8
Shell script to start/stop an EC2 instance to use as a ssh tunnel
#!/bin/bash
# Start/stop an EC2 instance to use as a ssh tunnel
# requires the aws package locally -- sudo apt-get install awscli
#
# usage: ./tunnel.sh start (spin up EC2 and create the tunnel)
# ./tunnel.sh stop (terminate the EC2 instance to save money)
# ./tunnel.sh resume (in case your tunnel is interrupted but the EC2 instance is still running)
# CHANGE THE PARAMETERS BELOW
@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 / 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 / install_phpbrew.md
Last active November 29, 2018 15:23
Using phpbrew

Install phpbrew

# Download phpbrew
cd ~/.local/bin
curl -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew
chmod +x phpbrew

# Install PHP build dependencies
sudo apt install libssl-dev libbz2-dev libcurl4-openssl-dev