Skip to content

Instantly share code, notes, and snippets.

View theY4Kman's full-sized avatar

Zach Kanzler theY4Kman

View GitHub Profile
@theY4Kman
theY4Kman / README.md
Last active March 11, 2019 17:56 — forked from mikelane/game_of_life.py
Conway's Game of Life implemented using a 2d convolution.

screenie

@theY4Kman
theY4Kman / hulu-chrome-omnibox-search-fix.tamper.js
Last active March 21, 2021 07:16
There seems no way to search Hulu from the Chrome omnibox, because it no longer fills the search bar using the `?q=query` param. This script resolves that issue.
// ==UserScript==
// @name Hulu fill search input from query params
// @namespace https://y4kstudios.com
// @updateUrl https://gist.github.com/theY4Kman/6e3680fdd5383992aeee5f3f4312dd8d/raw/e6d247c5e60d3411408f59faa82cdd833b84dac4/hulu-chrome-omnibox-search-fix.tamper.js
// @version 0.1
// @description There seems no way to search Hulu from the Chrome omnibox, because it no longer fills the search bar using the `?q=query` param. This script resolves that issue.
// @author You
// @match https://www.hulu.com/search?*
// @grant none
// ==/UserScript==
@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
import cmd
import sys
from fancycompleter import interact, DefaultConfig
class ConfigForTest(DefaultConfig):
use_colors = False
prefer_pyrepl = False
@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
@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 / 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
#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 / 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
@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"