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
function _expand_run | |
-d "Expand the 'run' abbreviation into a project-specific run command."; | |
if test -e Justfile; | |
echo just run | |
else if test -e Makefile; | |
echo make run | |
else if test -e Cargo.toml | |
echo cargo run | |
else if test -e package.json | |
echo npm run dev |
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/bash | |
# Create a database user with a random password, and print out a MongoDB connection string for that database. | |
# | |
# Requires: python >= 3.6, jq, and atlas-cli | |
set -e | |
CLUSTER='Sandbox' |
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
#!/usr/bin/env python3 | |
import sys | |
def main(): | |
i = sys.stdin.read() | |
sys.stdout.write(i.strip()) | |
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 random | |
import re | |
import sys | |
def _roll_func(count, sides): | |
def _roll(): | |
return sum(random.randint(1, sides) for _ in range(count)) | |
return _roll |
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
#!/usr/bin/env python3 | |
import argparse | |
from random import randint, choice | |
def uk(): | |
return randint(447700900000, 447700900999+1) | |
def us_area_code(): |
EuroPython 2018 is pleased to host and sponsor a free Women's Django Workshop on Monday 23rd July, from 9am-6pm.
Would you like to learn about how to build websites, but don’t know where to start? A group of volunteers will lead you through HTML, CSS, Python & Django to build a blog in a one day workshop. No prior programming knowledge is needed to participate! If you would like to take part, apply for a spot by filling in our application form
EuroPython 2018 sponsors this event, providing space and catering, together with other facilities.
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 inspect import isclass | |
import __builtin__ | |
# We're going to overwrite object, so we need to squirrel away the old one: | |
obj = object | |
# Metaclass, overriding the class' __getattribute__, | |
# so that __qualname__ can be generated and cached on access: | |
class QualnameMeta(type): |
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
[{ | |
"action": "talk", | |
"voiceName": "Brian", | |
"text": "May the fourth be with you!" | |
}] |
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 inspect import signature | |
def auto_args(f): | |
sig = signature(f) # Get a signature object for the target: | |
def replacement(self, *args, **kwargs): | |
# Parse the provided arguments using the target's signature: | |
bound_args = sig.bind(self, *args, **kwargs) | |
# Save away the arguments on `self`: | |
for k, v in bound_args.arguments.items(): | |
if k != 'self': |
NewerOlder