Skip to content

Instantly share code, notes, and snippets.

View tperalta82's full-sized avatar

Tiago Peralta tperalta82

View GitHub Profile
@tperalta82
tperalta82 / mysqldbcompare.py
Created November 23, 2023 01:37
Mysql Table data Compare
import mysql.connector
def get_table_data(host, port, user, password, database, table):
connection = mysql.connector.connect(
host=host,
port=port,
user=user,
password=password,
database=database
)
@tperalta82
tperalta82 / install_tools.sh
Created October 6, 2021 15:24 — forked from allenyllee/install_tools.sh
mount vhdx in linux
#!/bin/bash
# install qemu utils
sudo apt install qemu-utils
# install nbd client
sudo apt install nbd-client
@tperalta82
tperalta82 / gist:e508a2baaffc6148b953ecc77f2a398e
Created January 15, 2021 00:15 — forked from iraSenthil/gist:930328
Different ways to create and run thread
//Method with no parameter - ThreadStart Delegate
Thread t = new Thread (new ThreadStart (TestMethod));
t.Start();
void TestMethod() {}
//Method with a parameter - ParameterizedThreadStart Delegate
Thread t = new Thread (new ThreadStart (TestMethod));
t.Start(5);
t.Start("test");
void TestMethod(Object o) {}
@tperalta82
tperalta82 / github_delete_repos.sh
Created June 19, 2020 09:35
Remove Github Repos Batch
#!bin/bash
sudo apt update
sudo apt full-upgrade
sudo apt install curl jq
curl "https://api.github.com/users/YOURUSERNAME/repos?per_page=100&page=1" | jq -r '.[] | .name' | sed 's\^\YOURUSERNAME/\g' > delete_repos.txt
##code delete_repos.txt
read -p "Edit delete_repos.txt and delete the repos you want to keep from the list, then create a github token with delete_repos permissions"
while read repo; do curl -X DELETE -H "Authorization: token YOUR_TOKEN" "https://api.github.com/repos/$repo"; done < delete_repos.txt
@ECHO OFF
COLOR 1F
SET V=1.7
TITLE Windows 10 Registry tweaks for mining (x64) by: jsanzsp
ECHO #########################################################
ECHO # #
ECHO # WINDOWS 10 BUILD 10240 X64 #
ECHO # #
ECHO # #
ECHO # AUTOR: jsanzsp Ethereum Community Forum #
#!/bin/bash
set -e
# REQUIRED ACTION: Configure your backup server vars - see OVH Server Manager's "Backups" tab.
# BACKUP_HOST_PREFIX: use the prefix domain for the listed "Name" value on the "Backups" tab.
# Example: With a 'Name' value `ftpback-bhs1-3.ip-111-222-333.net` you would need to set `BACKUP_HOST_PREFIX=ftpback-bhs1-3`
# Add something likethese to your ~/.bashrc - /etc/profile
#export OVH_SERVER_ID="ns5xxxxx.ip-x-x-x.net"
#export BACKUP_HOST_PREFIX="ftpback-bhs1-x"
@tperalta82
tperalta82 / damnedd3.php
Last active May 3, 2018 23:43
Reboot D3 on fail board
#!/usr/bin/php
<?php
$hosts = array("antminer1","antminer2");
$minercreds = array( "user" => "root", "pass" => "becauseIAmHigh");
$failhashboard = "oxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxx";
/* I'm too stoned to try and detect how many hashboards are there*/
$possiblehashboards = 4;
foreach($hosts as $host)
{
@tperalta82
tperalta82 / README.md
Created May 17, 2017 15:47 — forked from Remiii/README.md
How to delete Vault (AWS Glacier)

How to delete Vault (AWS Glacier)

This Gist give some tips in order to remove AWS Glacier Vault with AWS CLI (ie. https://aws.amazon.com/en/cli/).

Step 1 / Retrive inventory

$ aws glacier initiate-job --job-parameters '{"Type": "inventory-retrieval"}' --vault-name YOUR_VAULT_NAME --account-id YOUR_ACCOUNT_ID --region YOUR_REGION
#!/bin/bash
DATABASES_TO_EXCLUDE="db1 db2 db3"
EXCLUSION_LIST="'information_schema','mysql','performance_schema'"
for DB in `echo "${DATABASES_TO_EXCLUDE}"`
do
EXCLUSION_LIST="${EXCLUSION_LIST},'${DB}'"
done
SQLSTMT="SELECT schema_name FROM information_schema.schemata"
SQLSTMT="${SQLSTMT} WHERE schema_name NOT IN (${EXCLUSION_LIST})"
MYSQLDUMP_DATABASES="--databases"
@tperalta82
tperalta82 / httpd-check.sh
Created September 22, 2016 01:32
Simple http-checker
#!/bin/bash
WBSRV=$(/usr/bin/timeout 10 /usr/bin/curl --verbose --header 'Host: pornhub.com' 'http://localhost/' -m 10 -f --silent > /dev/null 2>&1)
WBSRVSTAT=$?
SSTAT=$(/sbin/service httpd status)
LRET=$?
if [ $WBSRVSTAT -ne 0 ] || [ $LRET -ne 0 ]; then
subject="Apache Server Down / Unresponsive";
recipients="yourmom@stripclub.com,slip@knot.com"
message="Apache Service is down or not responding, restarting service, if it fails to restart or if you receive this message again in 1 minute, please check with your awesome sysadmins!