Skip to content

Instantly share code, notes, and snippets.

View jamesturk's full-sized avatar

James Turk jamesturk

View GitHub Profile
import boto3
client = boto3.client('s3')
s3 = boto3.resource('s3')
paginator = client.get_paginator('list_objects')
count = 0
for page in paginator.paginate(Bucket='data.example', Prefix='images', MaxKeys=10000):
for key in page['Contents']:
object_acl = s3.ObjectAcl('data.example', key['Key'])
@jamesturk
jamesturk / postgres_bulk.py
Created December 5, 2018 20:42
bulk loading from postgres
import csv
from io import StringIO
from django.db import connection
def postgres_bulk_copy(objects, ModelCls=None,
table_name=None,
fields=None, not_null=None, null=None,
include_id=False,
):
@jamesturk
jamesturk / person.yaml
Created September 24, 2018 17:05
mapping OCD people to YAML
full_name:
sort_name:
family_name/last_name:
given_name/first_name:
gender:
summary:
biography:
birth_date:
death_date:
@jamesturk
jamesturk / django1.9.rst
Last active December 15, 2015 11:07
django 1.9 notes

Django 1.9

RC1 released November 16th

contrib.postgres (round 2)

JSONField

@jamesturk
jamesturk / keybase.md
Last active May 13, 2016 13:29
keybase

Keybase proof

I hereby claim:

  • I am jamesturk on github.
  • I am jpt (https://keybase.io/jpt) on keybase.
  • I have a public key whose fingerprint is D9C8 FDB1 DB86 DAC9 0806 C573 0FB3 3E39 5D3B E8A6

To claim this, I am signing this object: