Skip to content

Instantly share code, notes, and snippets.

❄️
winter is coming

Oliver Bestwalter obestwalter

❄️
winter is coming
Block or report user

Report or block obestwalter

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@obestwalter
obestwalter / test_euler_1.py
Last active Aug 4, 2019
Solution for Euler 1 one the pytest way
View test_euler_1.py
"""Solve https://projecteuler.net/problem=1 the pytest way
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
"""
import pytest
@pytest.fixture(name="key", scope="session")
@obestwalter
obestwalter / submark-tox.md
Created Jul 3, 2019
running submark in tox
View submark-tox.md
< ~/code/3rd_party_code >  
git clone git@github.com:okken/submark.git && cd submark
[0] (git)-[submark/master:ebd5c4c2a88c ] < ~/code/3rd_party_code/submark >  
tox
.package create: /home/ob/code/3rd_party_code/submark/.tox/.package
.package installdeps: flit
py36 create: /home/ob/code/3rd_party_code/submark/.tox/py36
py36 installdeps: pytest, pytest-cov
py36 inst: /home/ob/code/3rd_party_code/submark/.tox/.tmp/package/1/submark-0.4.tar.gz
@obestwalter
obestwalter / roll-dice.py
Last active Jun 6, 2019
Is this too much for new programmers already?
View roll-dice.py
"""DICE ROLLER
By Al Sweigart al@inventwithpython.com
Example input:
3d6 rolls three 6-sided dice
1d10+2 rolls one 10-sided dice, and adds 2
2d17-1 rolls two 17-sided dice, and subtracts 1
QUIT quits the program
"""
@obestwalter
obestwalter / analyse.py
Last active Jul 17, 2018
Running tox 3.1 parseconfig over a random collection of tox.inis grabbed from github
View analyse.py
import logging
import os
from pathlib import Path
from tox.config import parseconfig
log = logging.getLogger("gh")
INI_PATH = Path(__file__).parent / "inis"
EXCLUDES = [
"python-package-skeleton",
@obestwalter
obestwalter / list.md
Created May 21, 2018 — forked from notwaldorf/list.md
Meownica's packing list
View list.md

Meownica's packing list

I travel a lot so I'm down to like 30 minutes of packing per any kind of trip. I always bring one carry-on suitcase for any trips up to 2 weeks (that I never check in unless forced) -- I have an Away suitcase because it's got a built-in (removable) battery, and amazing wheels.

🚨

  • 🆔Wallet & Passport
  • 💧Travel water bottle
  • 💳Travel credit cards (don't pay foreign currency fees!)
  • 💳Insurance cards
  • 💵Local currency you have
  • 🚎Local public transport cards
@obestwalter
obestwalter / pythoncamp-lightning-talk-pluggy.md
Created Apr 7, 2018
Pythoncamp 2018 - Lightning talk: pluggy
View pythoncamp-lightning-talk-pluggy.md

Shameless plug: pluggy powers pytest and tox

Make your tool extensible by 3rd party plugins by provding a pub/sub mechanism for plugin writers

WARNING: I have no idea what I am doing (yet)

Where?

Package on pypi

View tutorlinks
View keybase.md

Keybase proof

I hereby claim:

  • I am obestwalter on github.
  • I am obestwalter (https://keybase.io/obestwalter) on keybase.
  • I have a public key ASCELPCfKZiDlcykIiM_9416jD-2zFVuWm_P0kt-yuW46wo

To claim this, I am signing this object:

@obestwalter
obestwalter / test_plumbum_local_mock.py
Created Mar 8, 2017
Simple DIY plumbum local mock
View test_plumbum_local_mock.py
from plumbum.machines import LocalMachine
def get_item_mock(*_, **__):
def i_am_the_mocked_function():
print("I am mocked")
return "mock value"
return i_am_the_mocked_function
View trypy
#!/bin/bash
# An enhancement to the "python" executable that automatically launches you into the python debugger on error.
#
# Use it like you would the "python" executable, for example:
# $ trypy somefile.py
# or
# $ trypy somefile.py arg1 arg2
#
# EXAMPLE:
You can’t perform that action at this time.