I hereby claim:
- I am spenthil on github.
- I am sen (https://keybase.io/sen) on keybase.
- I have a public key ASAI2klc6Ew6TiLddaLAGYVeJ1JU-il7zrOy_lU4hnDeZwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| import requests | |
| api_key = "PRAGMATISMPLZ" | |
| shirtsio_url = "https://www.shirts.io/api/v1" | |
| def shirtsio_get(endpoint, params=None): | |
| params = params or dict() | |
| params["api_key"] = api_key | |
| response = requests.get(shirtsio_url + endpoint, params=params) | |
| if response.status_code != 200: |
| import zmq, zmq.eventloop.zmqstream,zmq.eventloop.ioloop | |
| import threading | |
| import logging | |
| logging.basicConfig(level=logging.DEBUG) | |
| logger = logging.getLogger() | |
| zmq.eventloop.ioloop.install() | |
| # run ioloop in separate thread |
| In [24]: InsuranceClaim.objects.annotate(num_invoiceitems=Count('invoiceitems')).filter(num_invoiceitems__gt=0).count() | |
| Out[24]: 29319 | |
| In [25]: InsuranceClaim.objects.annotate(num_invoiceitems=Count('invoiceitems')).filter(num_invoiceitems__eq=0).count() | |
| Out[25]: 9826 |
| from collections import Counter | |
| state = 'bpi' | |
| result = Counter(x.endswith("counsyl.com") for x in InsuranceClaim.objects.filter(status=state).values_list('orderkit__order__profile__user__email', flat=True)) | |
| total = sum(result.values()) / 100.0 | |
| percentages = {k:int(v/total) for k,v in result.iteritems()} | |
| print percentages |
| import requests | |
| from datetime import datetime | |
| import re | |
| from counsyl.product.billing.models import InsurancePayer | |
| def filing_blue_payer(payer_name, date=None): | |
| try: | |
| prefix = InsurancePayer.objects.get(name=payer_name).member_id_regexes.all()[0].regex | |
| except IndexError: | |
| return "no prefixes :(" |
| from django.core.management import setup_environ | |
| from counsyl.product import settings | |
| setup_environ(settings) | |
| from django.db.models.loading import get_models | |
| for m in get_models(): | |
| exec "from %s import %s" % (m.__module__, m.__name__) | |
| from pandas import * | |
| from collections import * |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd > | |
| <plist version="1.0"> | |
| <dict> | |
| <key>Label</key> | |
| <string>com.spenthil.osx.ipynb</string> | |
| <key>Program</key> | |
| <string>/usr/local/share/python/ipython</string> | |
| <key>ProgramArguments</key> | |
| <array> |
| #!/usr/bin/env python | |
| __version__ = ['1', '0', '0'] | |
| from django.conf import settings | |
| from django.core.management import ManagementUtility | |
| def inspectdb(name, engine='mysql', user='root', password='', host='', port=''): | |
| # setup django |
| tuple1 = () | |
| tuple2 = () | |
| dict1 = {} | |
| dict2 = {} | |
| list1 = [] | |
| list2 = [] | |
| # makes sense, tuples are immutable | |
| assert(id(tuple1) == id(tuple2)) | |
| # also makes sense dicts are mutable | |
| assert(id(dict1) != id(dict2)) |