Skip to content

Instantly share code, notes, and snippets.

View gumptionthomas's full-sized avatar

Thomas Bohmbach, Jr. gumptionthomas

  • Minneapolis, Minnesota, USA
View GitHub Profile
@bearfrieze
bearfrieze / comprehensions.md
Last active June 11, 2025 03:12
Comprehensions in Python the Jedi way

Comprehensions in Python the Jedi way

by Bjørn Friese

Beautiful is better than ugly. Explicit is better than implicit.

-- The Zen of Python

I frequently deal with collections of things in the programs I write. Collections of droids, jedis, planets, lightsabers, starfighters, etc. When programming in Python, these collections of things are usually represented as lists, sets and dictionaries. Oftentimes, what I want to do with collections is to transform them in various ways. Comprehensions is a powerful syntax for doing just that. I use them extensively, and it's one of the things that keep me coming back to Python. Let me show you a few examples of the incredible usefulness of comprehensions.

@mrdoob
mrdoob / gist:3879802
Last active October 15, 2021 02:15
Using Google Cloud Storage as web server.
www.example.com CNAME c.storage.googleapis.com
create www.example.com bucket.
gsutil setdefacl "public-read" gs://www.example.com
gsutil setwebcfg -m index.html -e 404.html gs://www.example.com
from the folder with the local copy:
gsutil -m cp -r -z html,js,css * gs://www.example.com
@mtigas
mtigas / timezones.py
Created November 29, 2010 00:58
Contains method to find the system local timezone.
#!/usr/bin/python
#
# Copyright 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
import urllib2, urllib
class RecaptchaResponse(object):
def __init__(self, is_valid, error_code=None):
self.is_valid = is_valid
self.error_code = error_code
def submit (recaptcha_challenge_field,
recaptcha_response_field,
private_key,