Skip to content

Instantly share code, notes, and snippets.

@sloria
sloria / bobp-python.md
Last active May 12, 2024 06:54
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@AniX
AniX / Cron-Job for deleting expired webapp2 UserToken
Created January 16, 2014 00:47
Code example how to implement a cron-job that deletes expired tokens in Google App Engine Python apps using webapp2 based authentication See http://blog.abahgat.com/2013/01/07/user-authentication-with-webapp2-on-google-app-engine/
import datetime
from google.appengine.ext import ndb
# eventually import custom User class here and adjust paths below
# parameter in timedelta() assumes that tokens expire ~3 months after creation:
expiredTokens = User.token_model.query(User.token_model.created <= (datetime.datetime.utcnow() - datetime.timedelta(3*365/12)))
# delete the tokens in bulks of 100:
while expiredTokens.count() > 0:
keys = expiredTokens.fetch(100, keys_only=True)
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active May 14, 2024 04:49
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\