This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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__) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pytest | |
def RecordResponse(title=None): | |
import pytest | |
class RecordResponse: | |
@pytest.mark.record_response(title=title) | |
def it_records_response(self): | |
pass |