Skip to content

Instantly share code, notes, and snippets.

View xlbruce's full-sized avatar
💭
Adena plz

Gilson de Paula xlbruce

💭
Adena plz
View GitHub Profile
@xlbruce
xlbruce / gist:42f393e3d69b867c28f857d7a4cc97a5
Created March 12, 2019 16:52
Publish local webhook behind NAT
https://serveo.net/
ssh -R myapp.serveo.net:80:localhost:8080 serveo.net
@xlbruce
xlbruce / letsencrypt.txt
Created December 27, 2018 13:19
Lets encrypt tutorial
https://www.vultr.com/docs/setup-letsencrypt-on-linux
@xlbruce
xlbruce / schedule_rds.sh
Last active February 20, 2019 13:22
Start or stop an RDS Instance as a cron on AWS
#!/bin/bash
maintenance_name=start-rds
rds_instance_id=rds-instance-name
dummy_ec2_id=i-00000000000000
task=AWS-StartRdsInstance # or AWS-StopRdsInstance
service_role=arn:aws:iam::00000000:role/MyRoleName
profile=default
region=us-east-1
cron_expression='cron(4 0 ? * MON-FRI *)' # From monday to friday at 07:00 PM (UTC)
@xlbruce
xlbruce / pricing.py
Last active October 26, 2018 19:39
Save EC2, RDS and ElastiCache prices into csv files.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import boto3
import csv
import json
import locale
import os
locale.setlocale(locale.LC_ALL,'')
@xlbruce
xlbruce / async_playbook.yml
Created September 5, 2018 17:06
Run arbitrary async commands
---
- name: Run async tasks
hosts: localhost
connection: local
gather_facts: no
tasks:
- name: Sleep 2 times
shell: /bin/sleep 5
async: 10000
poll: 0
@xlbruce
xlbruce / app.service
Created August 14, 2018 13:36
Systemd service template
[Unit]
Description=My Service Name
After=network.target
[Service]
Type=simple
User=<user>
Group=<group>
WorkingDirectory=/opt/app
ExecStart=/bin/ls -lh
@xlbruce
xlbruce / csv_to_json_post.py
Last active August 7, 2018 16:35
Convert reference prices in csv to json
import csv
import json
import sys
# Example csv file:
#originPlaceId;destinationPlaceId;travelCompanyId;serviceClassId;price;active;clientIds/0;clientIds/1;clientIds/2;clientIds/3;clientIds/4;clientIds/5
#3827;3022;35;1;416.55;VERDADEIRO;1;2;3;10013;10014;10015
try:
@xlbruce
xlbruce / ansible.cfg
Last active July 16, 2018 23:21
Ansible initial config example
# vim: ft=ansible_hosts
[defaults]
ansible_python_interpreter = /usr/bin/env python
ansible_managed = Ansible Managed. Please refrain from making manual changes.
host_key_checking = False
accept_hostkeys = yes
remote_user = admin
hash_behaviour = merge
retry_files_enabled = False
roles_path = roles
@xlbruce
xlbruce / test.txt
Last active July 6, 2018 15:40
Usage: python translate_words.py <input_file> <output_file>
{
"1": "Crate",
"2": "Cave Entrance",
"3": "Door",
"5": "Broken multicannon",
"6": "Dwarf multicannon",
"7": "Cannon base",
"8": "Cannon stand",
"9": "Cannon barrels",
"11": "Ladder",
@xlbruce
xlbruce / last-pom.sh
Created February 19, 2018 18:45
Check pom latest version for a directory based project
#!/bin/bash
# set -x
SNAPSHOT_REPO="http://nexus.clickbus.net:8081/nexus/content/repositories/snapshots2/com/clickbus/platform"
RELEASE_REPO="http://nexus.clickbus.net:8081/nexus/content/repositories/releases/com/clickbus/platform"
function getCurrentDir() {
local dir=`pwd`;
echo `basename $dir`;
}