Skip to content

Instantly share code, notes, and snippets.

View wbhinton's full-sized avatar

Weston Hinton wbhinton

View GitHub Profile
@wbhinton
wbhinton / check_hashrate_reboot.py
Last active January 5, 2018 02:48 — forked from jaydlawrence/check_hashrate_reboot.py
Script to check the hashrate of ethereum worker on ethOs and reboot if the hashrate is 0 for 2 runs of this script and there is a valid internet connection. The script pings google.com to check for a valid internet connection before executing the hashrate check. This script is for a single GPU, or rather it will only reboot if the overall hashra…
import subprocess
import os
import re
import sys
import argparse
import httplib, urllib
import time
"""
# place this file at /home/ethos/check_hash_reboot.py
@wbhinton
wbhinton / drive_monitor.py
Created October 20, 2019 20:27
Google Drive Shared Folder Monitor Using Python
from pydrive.auth import GoogleAuth
import io
from pydrive.drive import GoogleDrive
import datetime
from datetime import timedelta
import email, smtplib, ssl
from email import encoders
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
.mystyle {
font-size: 11pt;
font-family: Arial;
border-collapse: collapse;
border: 1px solid silver;
}
.mystyle td, th {
@wbhinton
wbhinton / pdf_summarizer.py
Last active November 27, 2019 19:52
Loop through a folder and summarize all PDFs
import PyPDF2
import textract
import nltk
import re
from tika import parser
import heapq
import glob
path = "pdf/*.pdf"
@wbhinton
wbhinton / awake.py
Created December 3, 2019 13:35
Python Script to keep your screen alive
import pyautogui
import time
import sys
from datetime import datetime
pyautogui.FAILSAFE = False
numMin = None
print('We will keep you computer awake by moving the mouse every 3 minutes. ¯\_(ツ)_/¯')
if ((len(sys.argv)<2) or sys.argv[1].isalpha() or int(sys.argv[1])<1):
numMin = 3
@wbhinton
wbhinton / df-to-html.py
Created December 3, 2019 16:08
Export Pandas DataFrame as a HTML Table
# Set the HTML Header with Bootstrap4 CSS for table formatting
html_string = """
<html>
<head><title>HTML Pandas Dataframe with CSS</title></head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<body>
{table}
</body>
</html>
@wbhinton
wbhinton / green-pbi.json
Created December 3, 2019 16:16
Dark Green Power BI Theme
{
"name": "GlobalLevelTemplate",
"dataColors": [
"#217c60",
"#009fae",
"#00a99c",
"#00b27e",
"#56b75a",
@wbhinton
wbhinton / list-all-dbs.sql
Created December 3, 2019 16:18
List All Databases on a server (MSSQL)
EXEC sp_helpdb;
--OR
EXEC sp_Databases;
--OR
SELECT @@SERVERNAME AS Server ,
name AS DBName ,
recovery_model_Desc AS RecoveryModel ,
Compatibility_level AS CompatiblityLevel ,
create_date ,
@wbhinton
wbhinton / table-desc.sql
Created December 3, 2019 16:20
List all tables in a database with descriptions
EXEC sp_tables;
-- Note this method returns both table and views.
--OR
SELECT @@Servername AS ServerName ,
TABLE_CATALOG ,
TABLE_SCHEMA ,
TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'
@wbhinton
wbhinton / table-col-def.sql
Created December 3, 2019 16:21
List all tables and columns in a DB with column definitions
-- Table Columns
SELECT @@Servername AS Server ,
DB_NAME() AS DBName ,
isc.Table_Name AS TableName ,
isc.Table_Schema AS SchemaName ,
Ordinal_Position AS Ord ,
Column_Name ,
Data_Type ,
Numeric_Precision AS Prec ,