Skip to content

Instantly share code, notes, and snippets.

@bar
bar / .gitconfig
Last active June 30, 2020 01:32
git alias
[push]
default = simple
[fetch]
prune = true
[user]
name = Ber Clausen
[core]
ignorecase = true
[filter "lfs"]
clean = git-lfs clean -- %f
@bar
bar / requests_ssl_session.py
Last active June 28, 2016 23:17
requests.ssl_session
from __future__ import absolute_import
import ssl
from requests import session
from requests.adapters import HTTPAdapter, DEFAULT_POOLBLOCK
from requests.packages.urllib3.poolmanager import PoolManager, SSL_KEYWORDS
try:
# python >=2.7.9
@bar
bar / keybase.md
Last active August 29, 2015 14:07

Keybase proof

I hereby claim:

  • I am bar on github.
  • I am bar (https://keybase.io/bar) on keybase.
  • I have a public key whose fingerprint is FA93 CD7B F2EE 5868 8A38 C0C7 D405 0F0F C5E1 5B81

To claim this, I am signing this object:

@bar
bar / .pdbrc
Last active April 17, 2020 06:56
# Print a dictionary, sorted. %1 is the dict, %2 is the prefix for the names.
alias p_ for __k, __v in sorted(%1.items()): print("{}{:<15}= {!r:<80.80}".format("%2", __k, __v))
# Print the member variables of a thing.
alias pi p_ %1.__dict__ %1.
# Print the member variables of self.
alias ps pi self
# Print the locals.
@bar
bar / gist:4015025
Created November 5, 2012 02:45
http_build_query() vs. buildQuery() - 100000 iterations (3 passes)
/**
* 100000 iterations x pass (3 passes)
* Router::queryString() uses http_build_query()
* Router::queryString2() uses buildQuery()
* Router::url() uses Router::queryString()
* Router::url2() uses Router::queryString2()
*/
/**
* Router::url()