Skip to content

Instantly share code, notes, and snippets.

View theY4Kman's full-sized avatar

Zach Kanzler theY4Kman

View GitHub Profile
@theY4Kman
theY4Kman / codewars-minesweeper.py
Created November 21, 2024 04:53
Original, uncleaned, log-spewing solution for Codewars Minesweeper kata: https://www.codewars.com/kata/57ff9d3b8f7dda23130015fa/train/python
from __future__ import annotations
from collections import defaultdict
from dataclasses import dataclass, field
from typing import Iterable, Self
from preloaded import open
@theY4Kman
theY4Kman / pg-table-sizes.sql
Created October 15, 2023 06:03
Show sizes of all tables in the public schema, itemized for tablespace alone, indexes size, and TOAST size
-- Sizes of all tables in the public schema
SELECT
table_name AS "Table",
pg_size_pretty(table_size) AS "Table Size",
pg_size_pretty(indexes_size) AS "Indexes Size",
pg_size_pretty(toast_size) AS "Toast Size",
pg_size_pretty(total_size) AS "Total Size"
FROM (
SELECT
table_name,
@theY4Kman
theY4Kman / BranchChangedFileLocalLineStatusTracker.kt
Created May 27, 2023 07:52
Branch Changed Files line status tracker
package com.github.rewstapp.packauthoring.openapi.vcs.impl
import com.github.rewstapp.packauthoring.psi.search.scope.packageSet.BranchChangedFilesCustomScopesProvider
import com.github.rewstapp.packauthoring.settings.PackAuthoringSettings
import com.intellij.diff.DiffApplicationSettings
import com.intellij.diff.DiffContentFactory
import com.intellij.diff.DiffManager
import com.intellij.diff.comparison.ByWord
import com.intellij.diff.comparison.ComparisonPolicy
import com.intellij.diff.contents.DiffContent
@task
def perchy(c):
"""Perchy Print"""
perchy = '''\
*:::
*::::::
*::::::::::
*:::::::::::::
*:::::::::::::::
*::::::::::::::::::
from _typeshed import Incomplete
from collections.abc import Generator
from typing import Any, Generic, Type, TypeVar
from sqlalchemy.orm.query import Query
from sqlalchemy.orm.session import Session
from . import utils as utils
from .model import DefaultMeta as DefaultMeta, Model as Model
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// ==UserScript==
// @name Enable paste on Quest
// @version 0.1
// @description Enable paste on Quest diagnostics input fields
// @updateURL https://gist.github.com/theY4Kman/8054da715976e1765655da4236ec4f6f/raw/quest-paste.user.js
// @match https://myquest.questdiagnostics.com/*
// @grant none
// ==/UserScript==
(function() {
@theY4Kman
theY4Kman / bakkesmod.dll-quality-strings.sh
Created October 26, 2021 16:03
Shows the quality strings returned by bakkesmod.dll
strings ./dll/bakkesmod.dll 2>&1 \
| \grep -E '^(Common|Uncommon|Rare|Very ?rare|Import|Exotic|Black ?market|Premium|Limited|Legacy)$'
Common
Rare
Very rare
Uncommon
Black market
Premium
Import
@theY4Kman
theY4Kman / requirements.txt
Last active May 19, 2024 19:56
Xfce4 panel plugin enabling easy switching between display profiles
pygobject
dbus-python
python-xlib
@theY4Kman
theY4Kman / named_pipes.py
Created July 20, 2021 20:49
A context manager that provides in-memory data to a spawned subprocess through a named pipe
import os
import threading
class StaticContentNamedPipe(threading.Thread, str):
"""Facilitates passing in-memory content to a spawned process as a named pipe (Linux only)
>>> import subprocess
>>> with StaticContentNamedPipe("my content") as named_pipe:
... proc = subprocess.run(["cat", named_pipe], pass_fds=[named_pipe],