Skip to content

Instantly share code, notes, and snippets.

View saulshanabrook's full-sized avatar
🏊

Saul Shanabrook saulshanabrook

🏊
View GitHub Profile
@saulshanabrook
saulshanabrook / trial
Created June 16, 2014 18:39
Open Data DC API Data Upload
$ 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 June 17, 2014 19:36
Post to OpenData DC
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 June 18, 2014 16:19
Delete Resource from OpenData DC
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"}}'
@saulshanabrook
saulshanabrook / brew install -v inkscape 2>&1
Created June 23, 2014 20:00
brew install inkspace error
==> 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 / readme.md
Created July 2, 2014 15:51
macdown gif not jumping

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]...
@saulshanabrook
saulshanabrook / $_php_-i
Last active August 29, 2015 14:03
paddle8 issue #78 cant save user
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=/
$ 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)
@saulshanabrook
saulshanabrook / shelve_recursive_memoization.py
Created July 24, 2014 18:17
recursive persistent memoization with python
import shelve
import functools
def cache(filename):
def decorating_function(user_function):
def wrapper(*args, **kwds):
key = str(hash(functools._make_key(args, kwds, typed=False)))
@saulshanabrook
saulshanabrook / Dockerfile
Last active August 29, 2015 14:04
docker python unicode read bug
FROM python:3
ADD . /code/
WORKDIR /code/
# ENV LANG C.UTF-8 if this is uncluded, no error
RUN python open_file.py
@saulshanabrook
saulshanabrook / README.md
Created October 13, 2014 14:53
Dynamic DNS on Cloudflare

Sets a cloudflare subdomain to your IP every 15 minutes.

$ brew install jq
$ crontab -e
# add this ->
30 * * * * /Users/canada/Documents/update-ip.sh