setting up zsh
install and setup zsh
echo $SHELL
if this is zsh go to the next stage, if not check zsh is installed
which zsh
[tool.black] | |
line-length = 120 | |
target_version = ['py37'] | |
exclude = ''' | |
( | |
/( | |
\.eggs # exclude a few common directories in the | |
| \.git # root of the project | |
| \.hg | |
| \.mypy_cache |
echo $SHELL
if this is zsh go to the next stage, if not check zsh is installed
which zsh
To understand what's happening with django generic class based views, lets create a function view where we handle all of the functionality explicity, then migrate the functionality to a class.
First let's setup the supporting files.
AWS API Gateway has the ability to pre-authenticate connections prior to launching the endpoint, by passing the authorizationToken
to a Lambda function. There are clear benefits for simplifying end point security and also a reduction in duplicated code by utilising this feature. However I found the AWS examples were excessively complicated for what should be a very simple task.
So here's my example.
The main concern is that AWS Lambda authentication expects a very specific response and if that response is not given it will throw a 500 error with x-amzn-ErrorType: AuthorizerConfigurationException
in the response header if the response object is not exactly as expected.
I personally use to handle the publishing part of my Lambdas, but I'll include an image of the API Gateway config.
import functools | |
import datetime | |
def timed_cache(maxsize=128, typed=False, **timedelta_kwargs): | |
def _wrapper(f): | |
update_delta = datetime.timedelta(**timedelta_kwargs) | |
next_update = datetime.datetime.utcnow() - update_delta | |
# Apply @lru_cache to f with no cache size limit | |
f = functools.lru_cache(maxsize=maxsize, typed=typed)(f) |
#!/bin/sh | |
HOSTNAME=`echo $@ | sed s/.*@//` | |
set_bg () { | |
osascript -e "tell application \"Terminal\" to set current settings of window 1 to (first settings set whose name is \"$1\")" | |
} | |
on_exit () { | |
set_bg "BenDog" |
<select id="reportFileName">
{% for report in reports_list %}
{% if report.year %}
{% for year in years %}
<option value="{{ report.id }}_{{ report.params }}_{{ year }}.html"> {{ report.name }} {{year}}</option>
{% for month in months %}
<option value="{{ report.id }}_{{ report.params }}_{{ year }}_{{ month}}.html"> {{ report.name }} {{year}} {{month}}</option>
{% end for %}
{% end for %}
I hereby claim:
To claim this, I am signing this object:
I'm passionate about elegant systems, whether these are for software solutions, managing people, documenting complex problems, or for helping people connect and become more productive.
I believe all systems should help and not hinder the users.
I'm a firm believer in iterative design and Agile methodologies, however in true agile form, I believe the best methodologies should be more like principles. Principles which we can borrow from when it makes sense, not laws which must be obeyed. However when presented with a problem I will always suggest we work towards a minimum viable product, get it out in the hands of the intended audience, and then get the feedback required to make it what it needs to become.