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 / newrelic-infra.yml
Created August 9, 2021 16:59
Install NewRelic Infrastructure "manually"
---
- name: Install NewRelic Infrastructure agent
hosts: newrelic_infra
become: yes
gather_facts: no
vars:
agent_url: "{{ package_url | default('https://download.newrelic.com/infrastructure_agent/binaries/linux/amd64/newrelic-infra_linux_1.19.4_amd64.tar.gz') }}"
package_path: /tmp/newrelic-infra.tar.gz
agent_path: /opt
newrelic_license_key: "{{ vault_newrelic_license_key }}"
@xlbruce
xlbruce / main.py
Last active April 30, 2021 15:02
Simple CSV to Excel converter.
import argparse
import asyncio
import glob
import os
import pandas as pd
# Setup parser
description = '''Convert CSV files or an entire directory to XLSX.\n
@xlbruce
xlbruce / main.go
Last active April 27, 2021 22:46
Primeiro programa em Go. Tenta descriptografar um PDF cuja senha seja de 3 dígitos numéricos, normalmente enviados pela [Vivo](https://vivo.com.br).
package main
//TODO publish to github reporitory
import (
"fmt"
"log"
"os"
"rsc.io/pdf"
)
@xlbruce
xlbruce / generate_credentials
Last active December 2, 2020 21:24
This script can be used in a EC2 instance to assume a role that lives in another account. IAM permissions must be set before use this.
#!/usr/bin/env python
# Intended to be used with Python 2.7.5
import json
import subprocess
import shlex
import sys
import os
import logging
import logging.handlers
@xlbruce
xlbruce / parse.sh
Created November 27, 2020 14:21
Dummy script to parse arguments using `shift` bash built-in
#!/bin/bash
function usage {
cat <<EOF
Usage: $0 [-dv] <path>
EOF
exit 1
}
verbose=0
@xlbruce
xlbruce / crimeflare.sh
Last active October 24, 2022 20:29
Discover real IP behind Cloudflare network
#!/bin/bash
function banner {
echo ' _____ _ ______ _ _____ _ _____ '
echo '/ __ \ (_) | ___| | / __ \| | |_ _|'
echo '| / \/_ __ _ _ __ ___ ___| |_ | | __ _ _ __ ___ | / \/| | | | '
echo "| | | '__| | '_ \` _ \ / _ \ _| | |/ _\` | '__/ _ \\ | | | | | | "
echo '| \__/\ | | | | | | | | __/ | | | (_| | | | __/ | \__/\| |_____| |_ '
echo ' \____/_| |_|_| |_| |_|\___\_| |_|\__,_|_| \___| \____/\_____/\___/ '
echo
@xlbruce
xlbruce / site.conf
Created October 25, 2019 03:58
Nginx cache
1 upstream apache {
2 server apache;
3 }
4
5 map $args $cache_bypass {
6 default 0;
7 ~nocache 1;
8 }
9
10 server {
@xlbruce
xlbruce / logrotate-example
Created July 7, 2019 01:15
logrotate example
/var/log/app.log {
rotate 30
daily
missingok
compress
delaycompress
dateext
olddir /var/log/app
dateformat .%Y-%m-%d
postrotate
@xlbruce
xlbruce / render.sh
Created April 2, 2019 12:00
Easy way to templating files with bash
#!/bin/bash
content=$(cat template.txt)
rendered=$(eval echo $content)
echo $rendered
@xlbruce
xlbruce / simpledb.py
Created March 19, 2019 13:52
AWS SimpleDB mini crud
import boto3
sdb = boto3.client('sdb')
domain_name = 'sdb_test'
def make_item(item_name, attributes):
return {
'ItemName': item_name,
'Attributes': [{'Name': k, 'Value': v, 'Replace': True} for k, v in attributes.items()]
}