Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris McDonough mcdonc

View GitHub Profile
@mcdonc
mcdonc / x
Created June 20, 2022 22:06
nix-shell command for compiling Python
View x
nix-shell -p gcc libunistring libidn2 bash tzdata zlib zlib.dev readline readline.dev bzip2 bzip2.dev ncurses ncurses.dev \
sqlite sqlite.dev openssl openssl.dev libuuid libuuid.dev gdbm lzlib tk tk.dev libffi libffi.dev expat expat.dev mailcap xz \
xz.dev
@mcdonc
mcdonc / Setup.local
Last active June 20, 2022 22:04
Modules/Setup.local file for building Python on NixOS
View Setup.local
zlib zlibmodule.c -lz
readline readline.c -lreadline
_lzma _lzmamodule.c -llzma
_sqlite3 _sqlite/cache.c _sqlite/connection.c _sqlite/cursor.c _sqlite/microprotocols.c _sqlite/module.c _sqlite/prepare_protocol.c _sqlite/row.c _sqlite/statement.c _sqlite/util.c -lsqlite3 -IModules/_sqlite
_curses _cursesmodule.c -lncurses
_bz2 _bz2module.c -lbz2
_lzma _lzmamodule.c -llzma
_ctypes _ctypes/callbacks.c _ctypes/cfield.c _ctypes/_ctypes_test.c _ctypes/malloc_closure.c _ctypes/callproc.c _ctypes/_ctypes.c _ctypes/stgdict.c -I_ctypes/ctypes_dlfcn.h -I_ctypes/ctypes.h -I_ctypes/_ctypes_test.h -lffi
_hashlib _hashopenssl.c -lssl -lcrypto
_ssl _ssl.c -lssl -lcrypto
View gist:13f6021767296e5842e71cb9bc5c5ad2
# validationtest.py single-file app
from pyramid.config import Configurator
from pyramid.view import view_config
from waitress import serve
import colander
from pyramid_deform import SessionFileUploadTempStore, CSRFSchema
import deform
from deform import widget
View gist:50d09e79e98467b456f7bd161142e106
from pyramid.config import Configurator
from pyramid.view import view_config
from waitress import serve
import colander
from pyramid_deform import SessionFileUploadTempStore, CSRFSchema
import deform
from deform import widget
@colander.deferred
View gist:c1cad2d10bab353ff8230f34155ed37a
### Keybase proof
I hereby claim:
* I am mcdonc on github.
* I am mcdonc (https://keybase.io/mcdonc) on keybase.
* I have a public key ASB_WBs_JoroZ76SlZJvQGbzm5lCeNzVubCGoYEj9Pu3sAo
To claim this, I am signing this object:
View gist:dfede0fbdba5f987727ee4afc75a35be
diff --git a/firestore/google/cloud/firestore_v1beta1/watch.py b/firestore/google/cloud/firestore_v1beta1/watch.py
index bc2b237bc1..a11313d6c3 100644
--- a/firestore/google/cloud/firestore_v1beta1/watch.py
+++ b/firestore/google/cloud/firestore_v1beta1/watch.py
@@ -619,10 +619,10 @@ class Watch(object):
assert name in updated_map, 'Document to delete does not exist'
old_document = updated_map.get(name)
# XXX probably should not expose IndexError when doc doesnt exist
- existing = updated_tree.find(old_document)
+ existing = updated_tree.find(name)
View gist:7db257d78173197f5957940307bfda37
=================================== FAILURES ===================================
_________ TestWatch.test__compute_snapshot_operation_relative_ordering _________
self = <tests.unit.test_watch.TestWatch testMethod=test__compute_snapshot_operation_relative_ordering>
def test__compute_snapshot_operation_relative_ordering(self):
from google.cloud.firestore_v1beta1.watch import WatchDocTree
doc_tree = WatchDocTree()
class DummyDoc(object):
View gist:524f3550f919c57a237be0ccc02610f5
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid import httpexceptions
def nocontent(request):
return httpexceptions.HTTPNoContent()
if __name__ == '__main__':
config = Configurator()
config.add_view(nocontent, route_name='nocontent')
View gist:7be3eeff292397b387db5143e1ffa0f4
_____________________________ test_watch_document ______________________________
client = <google.cloud.firestore_v1beta1.client.Client object at 0x7f5b1b24ca90>
cleanup = <built-in method append of list object at 0x7f5b18983d88>
def test_watch_document(client, cleanup):
db = client
doc_ref = db.collection(u'users').document(
u'alovelace' + unique_resource_id())
View gist:82454cecfb59d8268143
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@agendaless.com
ServerName bokehtest.agendaless.com
ErrorLog /var/log/apache2/bokeh-error.log
CustomLog /var/log/apache2/bokeh-access.log combined
RewriteEngine On
RewriteRule ^/(.*) http://127.0.0.1:5006/$1 [L,P]
ProxyPreserveHost On