Skip to content

Instantly share code, notes, and snippets.

@jbeezley
jbeezley / ls.py
Created April 8, 2015 18:04
Recursively list files in s3
#!/usr/bin/env python
import sys
import json
from boto.s3.connection import S3Connection
from boto.s3.prefix import Prefix
from boto.s3.key import Key
bucketname = sys.argv[1]
delimiter = '/'
@jbeezley
jbeezley / WRF2VTK.py
Created April 27, 2011 10:45
A python script to output vtk files from WRF-Fire output.
#!/usr/bin/env python
'''
WRF2VTK.py
Jonathan Beezley
April 27, 2011
This is a python script to convert WRF-Fire output files into a series
of vts (vtk structured grid) files. This script depends on the following
python modules:
@jbeezley
jbeezley / polyStats.py
Created August 23, 2012 22:27
A script to parse polygons contained in a kml or kmz file and print out statistics.
import sys
try:
from Polygon import *
except ImportError as e:
print 'Requires Polygon module from https://github.com/jraedler/Polygon2.'
print ''
print 'Try to install as follows:'
print ''
print 'git clone https://github.com/jraedler/Polygon2.git'
@jbeezley
jbeezley / gist:2818720
Created May 28, 2012 11:41
config.log
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by configure, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ ./configure --prefix=/usr/local/Cellar/gdal/1.9.1 --mandir=/usr/local/Cellar/gdal/1.9.1/share/man --disable-debug --with-local=/usr/local/Cellar/gdal/1.9.1 --with-threads --with-libtool --with-libtiff=internal --with-geotiff=internal --with-pcraster=internal --with-pcidsk=internal --with-bsb --with-grib --with-pam --with-libz=/usr --with-png=/usr/X11 --with-expat=/usr --with-jpeg=/usr/local --with-jpeg12 --with-gif=/usr/local --with-curl=/usr/bin/curl-config --with-sqlite3=/usr/local --without-grass --without-libgrass --without-poppler --with-liblzma=yes --with-netcdf=/usr/local --with-hdf5=/usr/local --with-jasper=/usr/local --with-cfitsio=/usr/local --with-epsilon=/usr/local --with-odbc=/usr/local --with-spatialite=/usr/local --with-xerces=/usr/local --with-freexl=/usr/local --wi
from dataclasses import dataclass
from factory import Faker
from factory.alchemy import SQLAlchemyModelFactory
from faker import providers
from sqlalchemy import Column, Integer, String
Faker.add_provider(providers.internet)
Faker.add_provider(providers.date_time)
#!/usr/bin/env python
import json
from stumpf.app import create_app
from stumpf.diva_fact_schemas import ActivityStatus
def main():
map = {}
app = create_app({})
#!/usr/bin/env python
import json
import sys
def main(ids):
if not len(ids):
print('Usage: %s id [id [id ...] ]' % sys.argv[0])
sys.exit(1)
try:
This file has been truncated, but you can view the full file.
{"1962013705373852446": "3674f223-c283-463c-bc32-a1980548d49d", "5656378033815299130": "9cfefbb4-b9c4-4875-9206-2561abf7d939", "576559719765483851": "1000b405-50d7-4296-b848-838aa2da1577", "41154296447279729": "01246b3a-a971-44e2-9cc3-c01f2ff9dbe0", "3369453097041011047": "5d85677a-b0f0-42ce-a0ca-cc1dbfebb720", "2752769918904771807": "4c679b50-1966-49bf-b58f-7a75d697218f", "238968998537044898": "06a1fa13-7c43-4745-a563-49ca02763780", "4553076208071124806": "7e5f8d60-42b9-4e8c-b20e-179c2c98bc02", "255144580194673543": "0714e949-a9bd-470f-9834-1ea5c53936bb", "1647741021997803455": "2dbbe775-7409-4f7e-a826-4de38dc988a3", "96525180692898501": "02adda47-e629-458b-9f40-7d91fe540e94", "2597774124104459621": "481a4b9a-c3e5-4acb-a43f-d1249c37949b", "4862498879735603223": "86f621ef-dec0-402e-9aee-fe249d8e11e0", "7108345004323317354": "c54bd43d-573a-4cd5-8aa8-9cbff2d27775", "2029140424725472151": "3851e8ee-4e4b-472e-8920-e1165d78c11c", "1059293324928755549": "1d66bb55-52a4-4ebb-a525-c812420e7b7b", "1329266215302506302":
def int_to_uuid(id):
h = hex(int(id) << 65)[2:]
assert len(h) <= 32
for i in range(len(h), 32):
h = '0' + h
assert len(h) == 32
return h[:8] + '-' + h[8:12] + '-' + h[12:14]
@jbeezley
jbeezley / gritsExample.py
Last active May 13, 2019 01:21
An example python script for making an API call to the GRITS database
#!/usr/bin/env python
import requests
import json
# main api url
url = 'https://grits.ecohealth.io/gritsdb/api/v1'
# put your username/password here
auth = ('myUsername', 'myPassword')