Skip to content

Instantly share code, notes, and snippets.

View obestwalter's full-sized avatar
❄️
winter is coming

Oliver Bestwalter obestwalter

❄️
winter is coming
View GitHub Profile
@obestwalter
obestwalter / recursion-reproducer.py
Last active February 20, 2022 17:06
When inspecting self in this way in a property it endlessly recursess
import traceback
class SomeClass:
a_class_attr = "don't find me"
def an_instance_method(self):
...
def _a_private_method(self):
@obestwalter
obestwalter / test_euler_1.py
Last active August 4, 2019 13:04
Solution for Euler 1 one the pytest way
"""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 July 3, 2019 17:08
running submark in tox
< ~/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 June 6, 2019 18:39
Is this too much for new programmers already?
"""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 July 17, 2018 21:08
Running tox 3.1 parseconfig over a random collection of tox.inis grabbed from github
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 19:57 — forked from notwaldorf/list.md
Meownica's packing list

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 April 7, 2018 13:03
Pythoncamp 2018 - Lightning talk: pluggy

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

@obestwalter
obestwalter / keybase.md
Last active September 16, 2017 16:53
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 March 8, 2017 12:16
Simple DIY plumbum local mock
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