Skip to content

Instantly share code, notes, and snippets.

View n0mn0m's full-sized avatar
🎧

Alexander Hagerman n0mn0m

🎧
  • Louisville, KY
View GitHub Profile
@n0mn0m
n0mn0m / login.py
Created December 21, 2019 01:08 — forked from MatthaeusHarris/login.py
Python3 script to stay logged in to a captive portal wifi network with a very short timeout
#!/usr/bin/env python3
# pip3 install selenium
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.options import Options
import time
@n0mn0m
n0mn0m / async_after_created.py
Created July 8, 2018 20:23
aioodbc additional configuration
import asyncio
import aioodbc
import pyodbc
from concurrent.futures import ThreadPoolExecutor
loop = asyncio.get_event_loop()
async def conn_attributes(conn):
conn.setdecoding(pyodbc.SQL_CHAR, encoding='utf-8')
conn.setdecoding(pyodbc.SQL_WCHAR, encoding='utf-8')
@n0mn0m
n0mn0m / RecurseRemove.sql
Created January 19, 2018 20:33
TSQL script to recursively iterate over a sql column and remove a range of characters. For this example remove the non printable ranges of ASCII
/*
Setup a recursive CTE to iterate over ascii ranges and remove
any characters within given ranges. Remember max recursion depth
is sql server is 100 by default
*/
--Initial increment handler
DECLARE @controlcharacter int = 32,
--Second increment handler
@extendedcharacter int = 256;
@n0mn0m
n0mn0m / AbstractDatabaseConnector.py
Last active September 14, 2017 12:53
An Abstract Base Class OOP example building on prior example for Code Louisville Fall 2017
import sqlite3
import pdb
from abc import ABCMeta, abstractmethod
class DatabaseConnector(metaclass=ABCMeta):
"""A class to help you connect to various databases"""
__metaclass__ = ABCMeta
_max_connections = 3
_current_connections = 0
@n0mn0m
n0mn0m / DatabaseConnector.py
Last active September 14, 2017 12:47
An OOP example for Code Louisville Python Fall 2017 Cohort
import sqlite3
import pdb
class DatabaseConnector(object):
_max_connections = 3
_current_connections = 0
def __init__(self, server, database, schema):
self.server = server,
self.database = database,
@n0mn0m
n0mn0m / scrape_zip_files.py
Created August 28, 2017 21:02
Quick script to parse an HTML page and extract zip files.
from bs4 import BeautifulSoup
from urllib.request import urlopen
import requests
import zipfile
import io
"""
Fails file extraction requires a password :(
"""