Skip to content

Instantly share code, notes, and snippets.

View julianobarbosa's full-sized avatar
💭
I may be slow to respond.

Juliano Barbosa julianobarbosa

💭
I may be slow to respond.
View GitHub Profile
@julianobarbosa
julianobarbosa / .tmux.conf
Created January 1, 2023 16:00 — forked from kawaz/.tmux.conf
tpm auto install
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm'"
@julianobarbosa
julianobarbosa / lambda_function.py
Created January 18, 2022 00:30 — forked from gregarious-repo/lambda_function.py
AWS Lambda to stop or start EC2 instances based on the instance tags.
import boto3
import time
##
# First function will try to filter for EC2 instances that contain a tag named `Scheduled` which is set to `True`
# If that condition is meet function will compare current time (H:M) to a value of the additional tags which defines the trigger `ScheduleStop` or `ScheduleStart`.
# Value of the `ScheduleStop` or `ScheduleStart` must be in the following format `H:M` - example `09:00`
#
# In order to trigger this function make sure to setup CloudWatch event which will be executed every minute.
# Following Lambda Function needs a role with permission to start and stop EC2 instances and writhe to CloudWatch logs.
@julianobarbosa
julianobarbosa / stress.sh
Created September 12, 2021 15:51 — forked from mikepfeiffer/stress.sh
Install Stress Utility on Amazon Linux 2
sudo amazon-linux-extras install epel -y
sudo yum install stress -y

Screen Quick Reference

Basic

Description Command
Start a new session with session name screen -S <session_name>
List running sessions / screens screen -ls
Attach to a running session screen -x
Attach to a running session with name screen -r
@julianobarbosa
julianobarbosa / run-ansible-with-any-host-without-inventory
Created November 17, 2019 22:15 — forked from lilongen/run-ansible-with-any-host-without-inventory
How to run Ansible without specifying the inventory but the host directly?
Question:
. How to run Ansible without specifying the inventory but the host directly?
. Run a playbook or command with arbitrary host not in the inventory hosts list?
. run ansible with arbitrary host/ip without inventory?
Answer:
Surprisingly, the trick is to append a ,
The host parameter preceding the , can be either a hostname or an IPv4/v6 address.
ansible all -i example.com,
@julianobarbosa
julianobarbosa / 256 colors.md
Created July 21, 2019 16:50 — forked from limingjie/256 colors.md
256 colors in putty, tmux/screen and vim

#256 colors in putty, tmux/screen and vim There is a detailed answer on stackoverflow. If you are looking for a short one, here it is.

  • putty

    Set Connection -> Data -> Terminal-type string to xterm-256color

  • tmux

Add this line to ~/.tmux.conf

@julianobarbosa
julianobarbosa / grafana-dashboard-exporter
Created January 22, 2019 18:26 — forked from crisidev/grafana-dashboard-exporter
Command to export all grafana 2 dashboard to JSON using curl
KEY=XXXXXXXXXXXX
HOST="https://metrics.crisidev.org"
mkdir -p dashboards && for dash in $(curl -k -H "Authorization: Bearer $KEY" $HOST/api/search\?query\=\& |tr ']' '\n' |cut -d "," -f 5 |grep slug |cut -d\" -f 4); do
curl -k -H "Authorization: Bearer $KEY" $HOST/api/dashboards/db/$dash > dashboards/$dash.json
done

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@julianobarbosa
julianobarbosa / how_to_install_tmux_on_centos
Created April 7, 2017 14:59 — forked from ekiara/how_to_install_tmux_on_centos
HOW TO: Install tmux on Centos release 6.5
# Install tmux on Centos release 6.5
# http://superuser.com/questions/738829/attempting-to-install-tmux-on-centos-6-4-or-centos-6-5-fails-with-error-evbuff
#
# READ THIS FIRST!!!
# MAKE SURE YOU HAVE BUILD TOOLS/COMPILERS TO BUILD STUFF FROM SOURCES
# yum groupinstall "Development Tools"
# CD TO TEMPORARY DIRECTORY
@julianobarbosa
julianobarbosa / update-dnsdynamic.sh
Created December 16, 2016 15:26 — forked from Mic92/update-dnsdynamic.sh
Update Public Ip on dnsdynamic.com
#!/bin/sh
# EDIT this
EMAIL=youremail@example.com
PASSWORD=yoursecret
DOMAIN=example.dnsd.me
IP=`curl --silent http://myip.dnsdynamic.com/`
curl --silent --user "$EMAIL:$PASSWORD" -k "https://www.dnsdynamic.org/api/?hostname=$DOMAIN&myip=$IP"