Skip to content

Instantly share code, notes, and snippets.

View wesleyit's full-sized avatar

Wesley Rodrigues wesleyit

View GitHub Profile
@wesleyit
wesleyit / keras_example.py
Created September 21, 2018 14:36
Python 3 + Keras: Simple neural network
# Create first network with Keras
from keras.models import Sequential
from keras.layers import Dense
import numpy as np
# Define your X and y here
X = np.array([[1, 0], [1, 1], [0, 1], [0, 0]])
y = np.array([1, 1, 1, 0])
# Create model
@wesleyit
wesleyit / free_memory.sh
Created October 16, 2018 17:43
This script can free memory by calling some kernel parameters via /proc/sys filesystem.
#!/bin/bash
if [ "$(whoami)" != "root" ]
then
echo "Execute este comando com sudo ou como root."
exit 1
fi
clear
echo '------------------------------------------------------------'
@wesleyit
wesleyit / runner.py
Created October 25, 2018 14:11
Run scheduled tasks in Python :D
"""
runner.py - This is a cron-like executor.
You can run Python files in scheduled times.
"""
import schedule
import time
# Files to run (ordered)
files_to_run = ['some_file_1.py', 'another_file_2.py']
@wesleyit
wesleyit / play_lumberjack.py
Last active February 26, 2019 13:20
Play lumberjack in Telegram using Python
# pip install pyscreenshot pyuserinput
import pyscreenshot
import pykeyboard
import time
X1 = 780
X2 = 785
Y1 = 410
Y2 = 420
@wesleyit
wesleyit / run_threads.py
Last active December 4, 2018 21:31
Run threads with sub processes
from multiprocessing import Pool as pool
from subprocess import Popen as run
from os import listdir as ls
# all files begining with this will be executed
PREFIX = 'python_scripts_'
# set for the number of cores you have
THREADS = 4
@wesleyit
wesleyit / grammarly.html
Created December 26, 2018 19:15
Dummy page for Grammarly checking
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Grammarly - Type your text</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
textarea {
font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
@wesleyit
wesleyit / start_workspace.py
Created February 26, 2019 13:55
This python script will call a PCOIP client window and give all necessary parameters for a connection.
# pip install pyuserinput
import subprocess
import sys
import time
import pykeyboard
if len(sys.argv) > 1:
ubiqui = sys.argv[1]
@wesleyit
wesleyit / csv_to_mysql_multithreads.py
Created March 2, 2019 22:43
Insert data from a CSV file to MySQL DB with multithreads
import sys
import pandas as pd
import numpy as np
from pandas.io import sql
from sqlalchemy import create_engine
from multiprocessing import Pool as pool
from threading import Lock as lock
# Get the data from CSV into a DataFrame
df = pd.read_csv('../bases/clientes.csv', sep=';')
@wesleyit
wesleyit / test_shellshock.sh
Last active April 2, 2019 16:54
Test for ShellShock Vulnerability (cve-2014-6271)
#!/bin/bash
docker run -d -p 8080:80 --name target hmlio/vaas-cve-2014-6271
cat << EOF | docker exec -i target bash
export EXPLOIT="() { echo 'Hello from Shell'; }; echo 'This machine is vulnerable'"
bash
EOF
@wesleyit
wesleyit / misc_databases_on_docker.sh
Created July 27, 2019 01:00
Many databases running on Docker (for testing purposes)
docker run --name postgres \
-e POSTGRES_USER=pgadmin \
-e POSTGRES_PASSWORD=pgpasswd \
-e POSTGRES_DB=pgdb \
-v /my/own/datadir:/var/lib/postgresql/data \
-d postgres
docker run --name mysql \
-e MYSQL_USER=myadmin \