This file contains 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 builtins | |
builtin_import = builtins.__import__ | |
paths = set() | |
def __import__(*args, **kwargs): | |
module = builtin_import(*args, **kwargs) |
This file contains 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
docker run -it --mount type=bind,source="$(pwd)",target=/build dacut/amazon-linux-python-3.6 bash -c "cd /build && pip3 install -r requirements.txt -t ./" |
This file contains 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
# Script to generate code for Coffee Machine Machine code golf | |
# https://codegolf.stackexchange.com/questions/149585/coffee-machine-machine | |
cm = """________._________ | |
| | \ - / | |
| || | \ - / | |
| || |___\___/ | |
| || | X | |
| | ___ | |
| | / - \\ |
This file contains 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 urllib.parse import urlparse | |
from django.conf import settings | |
from django.http.request import validate_host | |
from channels.exceptions import DenyConnection | |
class BaseOriginValidator(object): |
This file contains 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
"""Decorator to quickly add statsd (graphite) instrumentation to Celery | |
task functions. | |
With some slight modification, this could be used to instrument just | |
about any (non-celery) function and be made abstract enough to customize | |
metric names, etc. | |
Stats reported include number of times the task was accepted by a worker | |
(`started`), the number of successes, and the number of times the task | |
raised an exception. In addition, it also reports how long the task took |
This file contains 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
# gem install guard guard-shell; guard | |
guard 'shell' do | |
watch(%r{(.+)\.py}) do |m| | |
`django-admin.py test main` | |
end | |
end |
This file contains 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
#!/bin/sh | |
touch -t 197001010101 .last_run | |
while `true` | |
do | |
if [ ! -z "`find . -name \"*.py\" -cnewer .last_run 2>/dev/null`" ] ; then | |
django-admin.py test main | |
touch .last_run | |
fi | |
sleep 1 |
This file contains 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
vows = require('vows'); | |
assert = require('assert'); | |
vows.describe("Vows with asynchonous teardowns").addBatch({ | |
"Context with long-running teardown": { | |
"is run first": function () {}, | |
teardown: function () { | |
var callback = this.callback; | |
setTimeout(function () { |
This file contains 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
assert = require 'assert' | |
vows = require 'vows' | |
tornDown = false | |
vows.describe('Vows with asynchronous teardowns').addBatch | |
'Context with long-running teardown': | |
'is run first': () -> | |
teardown: () -> | |
setTimeout(() => | |
tornDown = true |
This file contains 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
assert = require 'assert' | |
vows = require 'vows' | |
tornDown = false | |
vows.describe('Vows with asynchronous teardowns').addBatch | |
'Context with long-running teardown': | |
'is run first': () -> | |
teardown: () -> | |
callback = @callback | |
setTimeout(() -> |
NewerOlder