Skip to content

Instantly share code, notes, and snippets.

View pavlokurochka's full-sized avatar
🧙‍♂️

Pavlo Kurochka pavlokurochka

🧙‍♂️
View GitHub Profile
@therealzanfar
therealzanfar / logging_snippets.py
Last active October 31, 2023 20:21
VSCode Snippets for Python Logging
"logging setup": {
"prefix": "logsetup",
"body": [
"import logging",
"from rich.logging import RichHandler",
"",
"def setup_logging(verbosity: int = 0, force: bool = False) -> None:",
"\t\"\"\"",
"\tSet up a root logger with console output.",
"",
@sanzoghenzo
sanzoghenzo / compare.py
Last active January 22, 2025 19:56
Compare Excel sheets with Pandas
"""
Compare two Excel sheets
Inspired by https://pbpython.com/excel-diff-pandas-update.html
For the documentation, download this file and type:
python compare.py --help
"""
import argparse
import pandas as pd
@ghego
ghego / talks_links.md
Last active November 14, 2019 17:59
All the links for talks
@jbrown123
jbrown123 / -Recursive Queries Using Common Table Expressions.md
Last active October 10, 2024 00:02
Creating arbitrary-depth recursive queries in SQLITE (works for any SQL compliant system) using CTEs (common table expressions)

Recursive Queries Using Common Table Expressions

Common Table Expressions (CTEs) are a bit complex and difficult to understand at first blush. Many of the tutorials and examples on the net don't make it any easier for those just starting out. I thought I'd put together a quick gist that tries to simplify the concept and demonstrate how to do recursive queries using CTEs.

Keep in mind that CTEs have other uses besides just recursive queries but this gist is just about how they can be used to create recursive searches.

I'm using SQLite in this example but any SQL language that implements the WITH keyword should be able to do the same thing. If you've never used SQLite before, you are missing out on an amazing, open source, stand alone, SQL engine. I encourage you to check it out.

A practical example

@nmpowell
nmpowell / windows_task_scheduler.py
Last active January 7, 2025 22:48
Python script to interact with existing Windows Task Scheduler tasks.
"""
Python script to interact with existing Windows Task Scheduler tasks.
CLI usage:
python windows_task_scheduler.py {enable|disable|run} -t "TaskName"
import usage:
import windows_task_scheduler as wts
wts.enable_task(task_name='TaskName')
wts.disable_task(task_name='TaskName')
@evanwill
evanwill / gitBash_windows.md
Last active May 6, 2025 00:17
how to add more utilities to git bash for windows, wget, make

How to add more to Git Bash on Windows

Git for Windows comes bundled with the "Git Bash" terminal which is incredibly handy for unix-like commands on a windows machine. It is missing a few standard linux utilities, but it is easy to add ones that have a windows binary available.

The basic idea is that C:\Program Files\Git\mingw64\ is your / directory according to Git Bash (note: depending on how you installed it, the directory might be different. from the start menu, right click on the Git Bash icon and open file location. It might be something like C:\Users\name\AppData\Local\Programs\Git, the mingw64 in this directory is your root. Find it by using pwd -W). If you go to that directory, you will find the typical linux root folder structure (bin, etc, lib and so on).

If you are missing a utility, such as wget, track down a binary for windows and copy the files to the corresponding directories. Sometimes the windows binary have funny prefixes, so

@TerryMooreII
TerryMooreII / gist:3773572
Created September 24, 2012 00:29
Get Oracle DBMS_Output from Python's cx_Oracle library
import cx_Oracle
conn = cx_Oracle.Connection("userid/password@tns")
curs = conn.cursor()
curs.callproc("dbms_output.enable")
sqlCode = """
some long
sql code
with dbms_output