Skip to content

Instantly share code, notes, and snippets.

View theY4Kman's full-sized avatar

Zach Kanzler theY4Kman

View GitHub Profile
@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 / 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 / beanstalk-instance-linker.tamper.js
Last active June 8, 2020 23:31
Link instance IDs on Beanstalk's Health page to the EC2 Console
// ==UserScript==
// @name Linkify beanstalk instances
// @namespace https://perchsecurity.com
// @updateURL https://gist.githubusercontent.com/theY4Kman/9938a82b2176aa4ef3fb38fec564500c/raw/beanstalk-instance-linker.tamper.js
// @version 1.0
// @description Link instance IDs to EC2 console in Beanstalk
// @author theY4Kman
// @match https://console.aws.amazon.com/elasticbeanstalk/*
// @match https://*.console.aws.amazon.com/elasticbeanstalk/*
// @grant none

Below are a list of the available Slack commands for Jukebot.

Command Description
/add track name Add a song to your Jukebot playlist
/album album name Search for an album
/artist artist name Search for an artist
/current playlist track
/delete Delete the currently playing track from your Jukebot playlist
/find track name Search for a track to add to your Jukebot playlist
@theY4Kman
theY4Kman / camel_words_collector.py
Created October 12, 2018 16:24
pytest plugin to allow matching class names on word boundaries
"""
In pytest.ini, we configure python_classes with wildcard patterns that are
checked with fnmatch. This can produce some unintentional effects; for instance,
the pattern For* also matches ForbidsAnonymousUsers, which we don't wish.
This plugin extends the semantics of fnmatch for python_classes, so a dash '-'
in the pattern matches a CamelWords boundary.
- For* will match "ForbidsAnonymousUsers" as well as "ForCurrentUser"
- For-* will match "ForCurrentUser", but not "ForbidsAnonymousUsers"
@theY4Kman
theY4Kman / django_rollback_transactions_middleware.py
Created October 4, 2018 04:59
A Django middleware which rolls back any DB changes at the end of the request. I found it useful when profiling SQL queries from POST/PUT requests, because I didn't have to find or generate so much test data
import logging
from contextlib import contextmanager
from django.db import transaction
from django.http import HttpRequest
from django.utils.deprecation import MiddlewareMixin
logger = logging.getLogger(__name__)
@theY4Kman
theY4Kman / django_subquery_only.py
Created October 4, 2018 04:56
A Django ORM Subquery Expression which only returns the specified fields
from django.db.models import Subquery
class SubquerySelect(Subquery):
"""Return only a subset of fields from a Subquery"""
template = '(SELECT %(fields)s FROM (%(subquery)s) AS %(subquery_alias)s)'
def __init__(self, queryset, output_field=None, fields=('*',), **extra):
self.fields = tuple(fields)
@theY4Kman
theY4Kman / django_postgres_arrays.py
Created October 4, 2018 04:55
A Django ORM Expression for Postgres ARRAY literals
from django.contrib.postgres.fields import ArrayField
from django.db.models import Expression, Value
from netfields import InetAddressField
class Array(Expression):
"""A Postgres ARRAY[] expression"""
def __init__(self, *items, output_field=None):
if output_field is None:
import pytest
def RecordResponse(title=None):
import pytest
class RecordResponse:
@pytest.mark.record_response(title=title)
def it_records_response(self):
pass
# XXX######################################################################################
# XXX######################################################################################
import os
import linecache
import sys
import time
from trace import Trace