Skip to content

Instantly share code, notes, and snippets.

Aapo Rista aapris

Block or report user

Report or block aapris

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
View keybase.md

Keybase proof

I hereby claim:

  • I am aapris on github.
  • I am aapris (https://keybase.io/aapris) on keybase.
  • I have a public key whose fingerprint is C06C C956 FA69 D9C7 2F71 01EF 20A9 AA27 8D69 8920

To claim this, I am signing this object:

@aapris
aapris / serialize_django_request.py
Last active Mar 5, 2019
Serialize Django>=2.2 HttpRequest
View serialize_django_request.py
"""
Sometimes you need to pass forward HttpRequest, which is not directly serializable.
serialize_django_request() takes Django HttpRequest as an argument, extracts
HttpRequest.headers (available since Django 2.2), HttpRequest.body and most interesting
values out from HttpRequest.META and returns them in a dict which is json, msgpack etc.
serializable.
"""
from django.http.request import HttpRequest
@aapris
aapris / pretty_4sq.py
Last active Sep 3, 2016
Pretty print your Foursquare history
View pretty_4sq.py
# Pretty print your Foursquare history
# remember to "pip install requests ics" into you virtualenv
import sys
import requests
from ics import Calendar
ics_data = requests.get(sys.argv[1]).text
cal = Calendar(ics_data)
for e in cal.events:
print("{} | {}".format(e.begin.format('YYYY-MM-DD HH:mm:ss ZZ'), e.name.lstrip('@ ')))
View keybase.md

Keybase proof

I hereby claim:

  • I am aapris on github.
  • I am aapris (https://keybase.io/aapris) on keybase.
  • I have a public key whose fingerprint is A35E 3622 48AD 67F6 6BEB FE71 7C58 6186 743C 17BF

To claim this, I am signing this object:

You can’t perform that action at this time.