Skip to content

Instantly share code, notes, and snippets.

🎆

Saul Shanabrook saulshanabrook

🎆
View GitHub Profile
@saulshanabrook
saulshanabrook / README.md
Last active Aug 29, 2015
Artwork Names and Descriptions from PP
View README.md

For my art history class, my teacher gave me a large PP with a slide for each artwork we needed to learn, so that I could use upload the images plus the artwork identifications and classifications to Memrise for virtual study cards.

I grew tired of copying the two lines from each slide, so I decided to try to parse the PP in python to export a list of artwork IDs and classifications. For example, here El Greco I wanted the output to be El Greco: Mannerism.

I found out that a .ppx file is really just a .zip, so once I extracted the PP it was easy to find the slide files, which were all .xml.

https://asciinema.org/a/8098

@saulshanabrook
saulshanabrook / README.md
Last active Aug 29, 2015
Prolific Genetic Programers
View README.md
View helpers.py
from collections import namedtuple
Parents = namedtuple('Parents', ['mother', 'father'])
from itertools import zip_longest
from collections import Counter, abc
class FrozenCounter(Counter):
'''
@saulshanabrook
saulshanabrook / trial
Created Jun 16, 2014
Open Data DC API Data Upload
View trial
$ http POST http://www.opendatadc.org/api/3/action/resource_update id=4010146d-bf4f-4c42-a838-20a1ab86945e id=techforelissa Authorization:4010146d-****
HTTP/1.1 404 Not Found
Access-Control-Allow-Headers: X-CKAN-API-KEY, Authorization, Content-Type
Access-Control-Allow-Methods: POST, PUT, GET, DELETE, OPTIONS
Access-Control-Allow-Origin: *
Cache-Control: no-cache
Content-Length: 441
Content-Type: application/json;charset=utf-8
Date: Mon, 16 Jun 2014 18:43:28 GMT
Pragma: no-cache
@saulshanabrook
saulshanabrook / .sh
Created Jun 17, 2014
Post to OpenData DC
View .sh
http POST http://www.opendatadc.org/api/3/action/resource_update --form id=4010146d-bf4f-4c42-a838-20a1ab86945e upload@contributions.csv url=http://www.opendatadc.org/dataset/campaign-finance/resource/4010146d-bf4f-4c42-a838-20a1ab86945e Authorization:7f99fd94-9f17-4a34-83b0-95d22aa0b0b7
@saulshanabrook
saulshanabrook / cant-delete-resource
Created Jun 18, 2014
Delete Resource from OpenData DC
View cant-delete-resource
In [11]: headers
Out[11]:
{'Authorization': '7f99fd94-****',
'Content-Type': 'application/x-www-form-urlencoded'}
In [12]: url
Out[12]: 'http://www.opendatadc.org/api/3/action/resource_delete'
In [13]: requests.post(url, headers=headers, data=json.dumps({'id': 'b0f4af1f-fbd4-45a6-82cd-86fab9140038'})).text
Out[13]: u'{"help": "Delete a resource from a dataset.\\n\\n You must be a sysadmin or the owner of the resource to delete it.\\n\\n :param id: the id of the resource\\n :type id: string\\n\\n ", "success": false, "error": {"message": "Access denied", "__type": "Authorization Error"}}'
View brew install -v inkscape 2>&1
==> Downloading https://downloads.sourceforge.net/project/inkscape/inkscape/0.48.4/inkscape-0.48.4.tar.gz
Already downloaded: /Library/Caches/Homebrew/inkscape-0.48.4.tar.gz
==> Verifying inkscape-0.48.4.tar.gz checksum
tar xf /Library/Caches/Homebrew/inkscape-0.48.4.tar.gz
==> ./configure --disable-dependency-tracking --prefix=/usr/local/Cellar/inkscape/0.48.4 --enable-lcms --disable-poppler-cairo
checking build system type... i386-apple-darwin13.2.0
checking host system type... i386-apple-darwin13.2.0
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
@saulshanabrook
saulshanabrook / $_php_-i
Last active Aug 29, 2015
paddle8 issue #78 cant save user
View $_php_-i
phpinfo()
PHP Version => 5.5.14
System => Darwin HP-520.local 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun 3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64
Build Date => Jul 2 2014 13:35:41
Configure Command => './configure' '--prefix=/usr/local/Cellar/php55/5.5.14' '--localstatedir=/usr/local/var' '--sysconfdir=/usr/local/etc/php/5.5' '--with-config-file-path=/usr/local/etc/php/5.5' '--with-config-file-scan-dir=/usr/local/etc/php/5.5/conf.d' '--with-iconv-dir=/usr' '--enable-dba' '--with-ndbm=/usr' '--enable-exif' '--enable-soap' '--enable-wddx' '--enable-ftp' '--enable-sockets' '--enable-zip' '--enable-shmop' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-mbstring' '--enable-mbregex' '--enable-bcmath' '--enable-calendar' '--with-zlib=/usr/local/opt/zlib' '--with-ldap' '--with-ldap-sasl=/usr' '--with-xmlrpc' '--with-kerberos=/usr' '--with-gd' '--enable-gd-native-ttf' '--with-freetype-dir=/usr/local/opt/freetype' '--with-jpeg-dir=/usr/local/opt/jpeg' '--with-png-dir=/
@saulshanabrook
saulshanabrook / readme.md
Created Jul 2, 2014
macdown gif not jumping
View readme.md

finance-scraper

Instructions

$ pip install dc-campaign-finance-data
Downloading/unpacking dc-campaign-finance-data
...
$ dc-campaign-finance-data
Usage: dc-campaign-finance-data [OPTIONS] COMMAND [ARGS]...
View output.sh
$ python3 shelve_test.py
Opening handle
No cached results, calling function
outside function
Opening handle
Traceback (most recent call last):
File "shelve_test.py", line 46, in <module>
other_expensive_calculation()
File "shelve_test.py", line 29, in wrapper
_check_cache(c, key, user_function, args, kwds)
You can’t perform that action at this time.