MicroPython version for the Mäxchen game.
Requirements:
- Pyboard
- lcd160cr
| CRATE_SIZE = 24 | |
| def beer_formula(rsvps): | |
| minimum = 1.3 | |
| maximum = 2 | |
| return int(minimum * rsvps), int(maximum * rsvps) | |
MicroPython version for the Mäxchen game.
Requirements:
| from pathlib import Path | |
| import pytest | |
| @pytest.fixture | |
| def file_factory(tmpdir): | |
| def _file_factory(path): | |
| full_path = Path(path) | |
| file_name = full_path.name |
| # stolen from https://stackoverflow.com/questions/20944483/python-3-sort-a-dict-by-its-values | |
| [(k, d[k]) for k in sorted(d, key=d.get, reverse=True)] |
| class PrivateClassesView: | |
| def post(self): | |
| # code omitted for readability sake | |
| data = { | |
| 'to': ['[email protected]'], | |
| 'body': 'blablabla', | |
| 'scheduled_for': datetime(2019, 3, 30, 11, 1, 0) | |
| } | |
| if subject: | |
| data['subject'] = subject |
| import random | |
| def choose_action(): | |
| actions = [ | |
| "It's time to drink water!", | |
| "Have you stretched on the last hour?", | |
| "You should walk around a bit", | |
| ] | |
| return random.choice(actions) |
| git for-each-ref | |
| --sort=-committerdate refs/heads/ | |
| --format='git branch -D %(color:yellow)%(refname:short)%(color:reset) # (%(color:green)%(committerdate:relative)%(color:reset))' |
| curl -u your_user:your_personal_token 'https://api.github.com/repos/OwnerHereAttentionItISSensitiveCase/repo-name/issues?labels=flaky-test&state=all' > flaky-tests.json | |
| # it requires the `repo` permission. you can generate your token here: https://github.com/settings/tokens - needed if you have 2FA enabled |
| import os | |
| from requests_oauthlib import OAuth1Session | |
| request_token_url = 'https://api.twitter.com/oauth/request_token' | |
| base_authorization_url = 'https://api.twitter.com/oauth/authorize' | |
| access_token_url = 'https://api.twitter.com/oauth/access_token' | |
| oauth = OAuth1Session(os.getenv('CONSUMER_KEY'), client_secret=os.getenv('CONSUMER_SECRET')) |
| from flask import Flask, url_for, session, request, redirect | |
| import os | |
| from cube.app import app, AuthToken | |
| from cube.api import get_twitter_api | |
| import twython | |
| import time | |
| api = get_twitter_api() |