Skip to content

Instantly share code, notes, and snippets.

View ryanlong1004's full-sized avatar
💭
Around here somewhere...

Ryan Long ryanlong1004

💭
Around here somewhere...
View GitHub Profile
@ryanlong1004
ryanlong1004 / gmail.py
Last active January 17, 2023 18:15
Python3 Gmail snippet
import json
import os
import pathlib
import smtplib, ssl
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
config = json.load(open(pathlib.Path(ROOT_DIR, "./config.json"), "r+"))
config["root_dir"] = os.path.dirname(os.path.abspath(__file__))
@ryanlong1004
ryanlong1004 / settings.json
Created January 15, 2021 20:23
Windows Terminal Settings
// This file was initially generated by Windows Terminal 1.3.2651.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "Bash",
// You can add more global application settings here.
@ryanlong1004
ryanlong1004 / keyboard_events.py
Created February 24, 2021 06:29
Fire Keyboard Events Python
import ctypes
from ctypes import wintypes
import time
user32 = ctypes.WinDLL('user32', use_last_error=True)
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
@ryanlong1004
ryanlong1004 / pip.md
Created October 1, 2021 18:12 — forked from saurabhshri/pip.md
Install and use pip in a local directory without root/sudo access.

Install and use pip in a local directory without root/sudo access.

Why?

Many users when are given server access, do not have root (or sudo) privileges and can not simply do sudo apt-get install python-pip . Here's an easy way you can install and use pip without root (or sudo) access in a local directory. Note : This works without easy_install too.

How?

@ryanlong1004
ryanlong1004 / gist:2389143582d2584fc1ebc8198cad0795
Created October 19, 2021 16:01 — forked from digitaljhelms/gist:4287848
Git/GitHub branching standards & conventions

Branching

Quick Legend

Description, Instructions, Notes
Instance Branch
@ryanlong1004
ryanlong1004 / main.py
Created January 10, 2022 18:17
Useful Python One-liners
# log current function name and local vars
logger.debug("fx=%s: vars=%s", inspect.stack()[0][3], locals())
@ryanlong1004
ryanlong1004 / remove_empty_folders.py
Last active January 18, 2022 02:31 — forked from jacobtomlinson/remove_empty_folders.py
Python Recursively Remove Empty Directories
#! /usr/bin/env python
"""
Module to remove empty folders recursively. Can be used as standalone script or be imported into existing script.
"""
import os
import argparse
import pathlib
import asyncio
import logging
@ryanlong1004
ryanlong1004 / logs.py
Created January 28, 2022 23:35
Python CLI Logging Option
import logging
def handle_logging(args):
levels = {
"critical": logging.CRITICAL,
"error": logging.ERROR,
"warn": logging.WARNING,
"warning": logging.WARNING,
"info": logging.INFO,
"debug": logging.DEBUG,
@ryanlong1004
ryanlong1004 / dbase.py
Created March 26, 2022 22:52
Quick Sqlite3 Implementation in Python
"""
gateway.py
Database interaction layer
author: Ryan Long <ryan.long@noaa.gov>
"""
import pathlib
import sqlite3
@ryanlong1004
ryanlong1004 / git.py
Created March 29, 2022 00:52
Base Git Abstraction for Python
"""
git.py
Git CLI interaction layer
author: Ryan Long <ryan.long@noaa.gov>
"""
import logging