Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
for file in $(find . -name '*.json'); do
res=$(python -c 'import sys, json; print json.dumps(json.load(sys.stdin), sort_keys=True, indent=2)' < $file || echo $file has syntax errors!);
if ! echo "$res" | diff -q - $file >/dev/null;then
echo processing $file
echo "$res" > $file
fi
done;
class descr_cls(object):
def __init__(self):
self.attr_in = 'was here in'
def __setattr__(self, instance, value):
print('set attr {}:{}'.format(instance, value))
self.__dict__[instance] = value
self.__dict__['{}_amended'.format(instance)] = (instance, value)
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDJhonSAV+YjBLMtFh923LO1oB441TbZR6IEiGzLduYA8eT49DxQ96yvQZMANajWqr9SaiWQqd9L/iJAGZsUrTA/20AHNV3tq6rM32DX0NGiqiKaYE9Fb2VC8YsslOqdYCKpalAifaHNL2C5IvRxBk4j5qzW8iLC6CKBYGs+JHogapRo7ADMeQSjwC1Wo41svvC/wvPgP1C9i1jlwDih255naOdV6b/bTMth+SRXKIFi88Z7pHdQWYvCoB+D4idN+IDoTQ0jt2vLqMIWH9lM3vrf9l2NX7HdrHiNyCgLX8GqEMec6z/sWIsfkfkI88zyJXKE2dvjwxPBuWXyNzXJjaz
### Keybase proof
I hereby claim:
* I am mkutsevol on github.
* I am mkutsevol (https://keybase.io/mkutsevol) on keybase.
* I have a public key whose fingerprint is CA6F DA5F CD7B 574E 7C47 C0F2 07D2 D7B3 72AD DADD
To claim this, I am signing this object:
@mkutsevol
mkutsevol / gist:5555382
Created May 10, 2013 16:02
patch for py-amqp under python3 not to add bytes to str
diff --git a/amqp/transport.py b/amqp/transport.py
index 8092c5f..e9ee76a 100644
--- a/amqp/transport.py
+++ b/amqp/transport.py
@@ -191,7 +191,7 @@
as you're asking for, at least with extremely large messages.
somewhere > 16K - found this in the test_channel.py test_large
unittest."""
- result = ''
+ result = b''
@mkutsevol
mkutsevol / gist:5555372
Created May 10, 2013 16:00
py-amqp python error traceback
File "/usr/local/lib/python3.3/dist-packages/kombu-2.5.10-py3.3.egg/kombu/messaging.py", line 164, in publish
routing_key, mandatory, immediate, exchange, declare)
File "/usr/local/lib/python3.3/dist-packages/kombu-2.5.10-py3.3.egg/kombu/messaging.py", line 169, in _publish
channel = self.channel
File "/usr/local/lib/python3.3/dist-packages/kombu-2.5.10-py3.3.egg/kombu/messaging.py", line 186, in _get_channel
channel = self._channel = channel()
File "/usr/local/lib/python3.3/dist-packages/kombu-2.5.10-py3.3.egg/kombu/utils/__init__.py", line 392, in __call__
value = self.__value__ = self.__contract__()
File "/usr/local/lib/python3.3/dist-packages/kombu-2.5.10-py3.3.egg/kombu/messaging.py", line 201, in <lambda>
channel = ChannelPromise(lambda: connection.default_channel)