Skip to content

Instantly share code, notes, and snippets.

View Alphadelta14's full-sized avatar
⚔️
Load average: 233.0

Heather Lapointe Alphadelta14

⚔️
Load average: 233.0
View GitHub Profile
@Alphadelta14
Alphadelta14 / bash_traceback.sh
Created February 4, 2023 00:11
Bash Traceback
#!/usr/bin/env bash
# exit on error (errexit)
set -e
# pass ERR trap to subshells (errtrace)
set -E
# Callback function for when set -e (ERREXIT) is triggered)
# This shows a small stacktrace for the current shell along with the failing
# function call.
function _show_traceback() {
@Alphadelta14
Alphadelta14 / certifi-2018.10.15-use-system-cert.patch
Created May 13, 2021 14:31
certifi-2018.10.15-use-system-cert.patch
diff -r -u certifi-2018.10.15.orig/certifi/core.py certifi-2018.10.15/certifi/core.py
--- certifi-2018.10.15.orig/certifi/core.py 2018-01-18 15:27:24.000000000 -0500
+++ certifi-2018.10.15/certifi/core.py 2018-12-13 11:08:30.834151536 -0500
@@ -19,9 +19,7 @@
def where():
- f = os.path.dirname(__file__)
-
- return os.path.join(f, 'cacert.pem')
@Alphadelta14
Alphadelta14 / cyargs.py
Created April 12, 2018 11:07
Cython breaks passing kwargs to functions with one args
from __future__ import print_function
def func_one_arg(a):
print('one arg')
def func_one_kwarg(a=1):
print('one kwarg')
class BoundCondition(ConditionalMixin):
def __init__(self, build=None, suite=None, callback=None):
self.bound_build = build
self.bound_suite = suite
self.bound_callback = callback
ConditionalMixin.__init__(self)
@staticmethod
def build(build_inst):
condition = BoundCondition(build=build_inst)
@Alphadelta14
Alphadelta14 / entities.out
Created January 2, 2017 18:52
html entities regex
In [18]: expr
Out[18]: re.compile(r'&(zwnj|aring|gt|yen|ograve|Chi|bull|pound|Egrave|trade|Ntilde|upsih|Yacute|Atilde|radic|otimes|aelig|oelig|equiv|Psi|auml|cup|Epsilon|otilde|Eta|lt|rsquo|Icirc|Eacute|Lambda|yacute|Prime|prime|psi|Kappa|rsaquo|Tau|uacute|sigmaf|lrm|lceil|Alpha|cedil|atilde|theta|not|kappa|AElig|oslash|acute|zwj|laquo|dArr|rdquo|ge|Igrave|hArr|micro|lsaquo|euro|shy|sdot|supe|nbsp|lfloor|lArr|Auml|larr|brvbar|Otilde|szlig|clubs|agrave|Ocirc|ndash|Theta|Pi|OElig|Scaron|thetasym|egrave|sub|iexcl|frac12|ordf|sum|prop|Uuml|ntilde|sup|asymp|uml|prod|nsub|reg|Oslash|THORN|yuml|infin|Mu|le|thinsp|ecirc|bdquo|Sigma|Aring|tilde|nabla|mdash|uarr|permil|tau|Ugrave|fnof|Agrave|chi|forall|circ|eth|rceil|iuml|gamma|lambda|harr|rang|xi|dagger|divide|Ouml|Ograve|image|alefsym|rlm|igrave|Yuml|sube|alpha|frasl|ETH|lowast|Nu|plusmn|Euml|sup1|sup2|frac34|Aacute|cent|oline|Beta|perp|emsp|loz|pi|iota|empty|euml|notin|Upsilon|para|epsilon|Delta|weierp|there4|part|icirc|delta|omicron|upsilon|copy|Iuml|Oacute|Xi|ensp
def test_partitioning():
expr = re.compile(r'\*(.*)\*')
children = [docutils.nodes.Text('hello *world* goodbye')]
left, matched, right = inline.re_partition(children, expr)
print(left, matched, right)
assert len(left) == len(right) == 1
assert len(matched) == 2
assert len(matched[0]) == len(matched[1]) == 1
assert left[0] == 'hello '
assert right[0] == ' goodbye'
@Alphadelta14
Alphadelta14 / twitter_oauth.php
Last active November 26, 2016 01:52
IPS [bad] twitter oauth
<?php
/**
* Send Request
*
* @param string $method HTTP Method
* @param string $url URL
* @param array $params Parameters
* @param string $token OAuth Token
* @return \IPS\Http\Response
* @throws \IPS\Http\Request\Exception
@Alphadelta14
Alphadelta14 / flow1.py
Created November 15, 2016 15:03
Compat Flows
def main():
if product_one_env():
build = build_one()
deploy = deploy_one(build)
run_one(deploy, build)
elif product_two_env():
build = build_two()
deploy = deploy_two(build)
run_two(deploy, build)
def test_parseable():
parser = ArgumentPasserParser()
parser.add_optional_bool('-n')
parser.add_optional_bool('--rm')
parser.add_optional_bool('--detach')
parser.add_optional_bool('--interactive')
parser.add_argument('image')
parser.add_argument('command', nargs=argparse.REMAINDER)
args = parser.parse_args(['--interactive',
DOCKER(1) JUNE 2014 DOCKER(1)
NAME
docker-run - Run a command in a new container
SYNOPSIS
docker run [-a|--attach[=[]]] [--add-host[=[]]]
[--blkio-weight[=[BLKIO-WEIGHT]]] [--blkio-weight-device[=[]]]
[--cpu-shares[=0]] [--cap-add[=[]]] [--cap-drop[=[]]]
[--cgroup-parent[=CGROUP-PATH]] [--cidfile[=CIDFILE]] [--cpu-period[=0]]