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': |
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 -e | |
# | |
# tweet-syntax - Create a syntax-highighted PNG file of your code and save in /tmp | |
# | |
# Prerequisites: | |
# pip install --upgrade pygments pillow | |
# 'Source Code Pro' font (or change the script below) | |
# | |
# Usage: cat code.ext | tweet-syntax [<syntax>] |
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
# Pass the env-vars to MYCOMMAND | |
eval $(egrep -v '^#' .env | xargs) MYCOMMAND | |
# … or ... | |
# Export the vars in .env into your shell: | |
export $(egrep -v '^#' .env | xargs) |
NewerOlder