x = ['print("x =", x)', 'for s in x: print(s)']
print("x =", x)
for s in x: print(s)
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
| { | |
| "did": "did:plc:kcdfeq447izcyu2kddv66ewz" | |
| } |
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
| { | |
| "did": "did:plc:kcdfeq447izcyu2kddv66ewz" | |
| } |
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 asyncio | |
| async def gather_functions(funcs): | |
| tasks = [asyncio.create_task(f) for f in funcs] | |
| return await asyncio.gather(*tasks) | |
| def run(funcs): | |
| """ | |
| Run a list of async functions and return the results. |
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 xml.etree.ElementTree import Element, tostring | |
| def dict_to_xml(tag: str, d: dict) -> str: | |
| """ | |
| Converts a Python dictionary to an XML tree, and then returns | |
| it as a string. | |
| Works with recursively nested dictionaries! | |
| "tag" is the name of the top-level XML tag. | |
| """ | |
| elem = Element(tag) |
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 contextlib import ContextDecorator | |
| class me_decorate(ContextDecorator): | |
| def __init__(self, *args, **kwargs): | |
| self.input_value = kwargs.get('keyword') | |
| super(me_decorate, self).__init__() | |
| def __enter__(self, *args, **kwargs): | |
| print(self.input_value) |
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 python 3.6 dictionaries are ordered: | |
| "The order-preserving aspect of this new implementation | |
| is considered an implementation detail and should | |
| not be relied upon." | |
| But let's face it, we're going to use it and it is | |
| going to become a consistent feature. |
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 import models | |
| class DateTimeModel(models.Model): | |
| class Meta: | |
| abstract = True | |
| date_created = models.DateTimeField(auto_now_add=True) | |
| date_updated = models.DateTimeField(auto_now=True) |
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
| # Virtualenv wrapper stuff | |
| export WORKON_HOME=~/Envs | |
| VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3 | |
| source /usr/local/bin/virtualenvwrapper.sh | |
| # Make sure virtualenv is active before using pip | |
| export PIP_REQUIRE_VIRTUALENV=true | |
| # Various git shorthands | |
| alias gs="git status" |
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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>AboutToPasteTabsWithCancel</key> | |
| <true/> | |
| <key>AboutToPasteTabsWithCancel_selection</key> | |
| <integer>2</integer> | |
| <key>AppleAntiAliasingThreshold</key> | |
| <integer>1</integer> |
NewerOlder