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

#1 Add them directly to you code

import pdb; pdb.set_trace()
# or
import ipdb; ipdb.set_trace()

#2: Set them interactively

python -m pdb hello.py
@julianobarbosa
julianobarbosa / .bash_aliases.example
Created July 22, 2020 09:17
bash, aliases, docker, docker-compose, traefik, swarm
# DOCKER
alias dstopcont='sudo docker stop $(docker ps -a -q)'
alias dstopall='sudo docker stop $(sudo docker ps -aq)'
alias drmcont='sudo docker rm $(docker ps -a -q)'
alias dvolprune='sudo docker volume prune'
alias dsysprune='sudo docker system prune -a'
alias ddelimages='sudo docker rmi $(docker images -q)'
alias docerase='dstopcont ; drmcont ; ddelimages ; dvolprune ; dsysprune'
alias docprune='ddelimages ; dvolprune ; dsysprune'
alias dexec='sudo docker exec -ti'
@julianobarbosa
julianobarbosa / Vagrant-5.0-lts
Created May 7, 2020 23:39
Vagrant Zabbix Ubuntu
# -*- mode: ruby -*-
# vi: set ft=ruby :
NAME = "zabbix-5-lts"
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"profiles": [
{
"guid": "{8a993db9-7368-4f5a-8af5-b3cdf876bf34}",
"hidden": false,
"name": "PowerShell 7 Preview",
@julianobarbosa
julianobarbosa / pip-update.sh
Created March 5, 2020 14:06
Python3, pip, update
for i in `python -m pip list -o | cut -d ' ' -f 1`
do
python -m pip install -U $i
done
@julianobarbosa
julianobarbosa / is_port_open.py
Created February 7, 2020 10:46
Python, TCP, UDP, Port
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(2) #2 Second Timeout
result = sock.connect_ex(('127.0.0.1',80))
if result == 0:
print 'port OPEN'
else:
print 'port CLOSED, connect_ex returned: '+str(result)