Skip to content

Instantly share code, notes, and snippets.

View theY4Kman's full-sized avatar

Zach Kanzler theY4Kman

View GitHub Profile
@theY4Kman
theY4Kman / triggers.sp
Created January 15, 2021 23:42
Screwing around w/ updating formatting on Triggers SourceMod plugin – https://forums.alliedmods.net/showthread.php?t=67098
#pragma semicolon 1
#include <sourcemod>
#define PLUGIN_VERSION "2.3.0"
public Plugin:myinfo = {
name = "Triggers",
author = "theY4Kman",
description = "Advanced commandlist.txt functionality",
@theY4Kman
theY4Kman / clip_magic.py
Last active September 21, 2020 23:55 — forked from bwagner/clip_magic.py
copy to clipboard ipython magic
"""
Add copy to clipboard from IPython!
To install, just copy it to your profile/startup directory, typically:
~/.ipython/profile_default/startup/
Example usage:
%clip hello world
# will store "hello world"
@theY4Kman
theY4Kman / 00-a_README.md
Last active June 8, 2020 22:45
IPython customizations affording Ctrl-Backspace, Ctrl-Home, Ctrl-End, as well as a few handy magics

Install to:

  • ipython_config.py~/.ipython/profile_default/ipython_config.py
  • 00-keybindings.py~/.ipython/profile_default/startup/00-keybindings.py
  • 10-line-magics.py~/.ipython/profile_default/startup/10-line-magics.py
#include <string.h>
#include <dlfcn.h>
#include <libxfce4util/libxfce4util.h>
#include <libxfce4panel/xfce-panel-plugin.h>
#include <gtk/gtk.h>
#include <Python.h>
#include <canberra.h>
#include <gsound.h>
@theY4Kman
theY4Kman / gtk_cssselect.py
Created May 16, 2020 11:11
Query for GTK widgets using CSS syntax
from typing import Callable, Iterable, List
import cssselect
import gi
from cssselect import GenericTranslator
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
@theY4Kman
theY4Kman / pytest_pretty_diffs.py
Last active April 9, 2020 19:23
pytest plugin to show icdiff-powered diffs for equality comparisons between collections
import ast
import traceback
from _pytest.config import Config
from icdiff import ConsoleDiff
import terminal_helpers
import util_pprint
@theY4Kman
theY4Kman / ipython_config.py
Created January 12, 2020 20:12
An IPython config file which adds some familiar key bindings, such as Ctrl+Home/End and Ctrl+Backspace. Supports prompt-toolkit v2 and v3
"""
This ipython config file installs a few extra prompt key bindings for a more
familiar editing interface. In particular, it adds support for:
- Ctrl+Home:
move to the beginning of the buffer
- Ctrl+End:
move to the end of the buffer
import cmd
import sys
from fancycompleter import interact, DefaultConfig
class ConfigForTest(DefaultConfig):
use_colors = False
prefer_pyrepl = False
@theY4Kman
theY4Kman / wrap_fixture.py
Created May 26, 2019 20:03
pytest utility method for creating wrapper or factory fixtures, allowing methods defined elsewhere to request fixtures, while augmenting their return value
import functools
from typing import Callable, Iterable
from _pytest.compat import get_real_func, getfuncargnames
from _pytest.fixtures import call_fixture_func
def wrap_fixture(fixturefunc: Callable, wrapped_param: str = 'wrapped') -> Callable[[Callable], Callable]:
"""Wrap a fixture function, extending its argspec w/ the decorated method