Skip to content

Instantly share code, notes, and snippets.

View dustindorroh's full-sized avatar

Dustin Dorroh dustindorroh

View GitHub Profile
@dustindorroh
dustindorroh / create_landmark_tf_record.py
Last active September 2, 2019 07:19
Creating keypoints tfrecords in using tensorflow's object_detection.
# create_head_tf_record.py
#
# Created by Dustin Dorroh on 1/07/2019
#
import hashlib
import io
import json
import logging
import os
@dustindorroh
dustindorroh / image_deduplication_and_url_signing.py
Created August 30, 2019 03:26
Runs DHash on a csv containing paths to images using Dask. Deletes duplicates (prefering to keep larger images). Rename Images to Dhash name. Create AWS signed urls
import pandas as pd
import imagehash
from PIL import Image
from dask import dataframe as dd
from dask.diagnostics import ProgressBar
from dask.diagnostics import Profiler, ResourceProfiler, CacheProfiler, visualize
from pathlib import Path
import shutil
def create_presigned_url(bucket_name, object_name, expiration=3600):
@dustindorroh
dustindorroh / presigned_urls.py
Last active August 30, 2019 03:00
Create a presigned url for an s3 object
import logging
import boto3
from botocore.exceptions import ClientError
def create_presigned_url(bucket_name, object_name, expiration=3600):
"""Generate a presigned URL to share an S3 object
:param bucket_name: string
:param object_name: string
@dustindorroh
dustindorroh / python_rsa_example.py
Last active December 12, 2023 02:21
RSA Encryption/Decryption with python
# Inspired from https://medium.com/@ismailakkila/black-hat-python-encrypt-and-decrypt-with-rsa-cryptography-bd6df84d65bc
# Updated to use python3 bytes and pathlib
import zlib
import base64
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_OAEP
from pathlib import Path
@dustindorroh
dustindorroh / oswrap.py
Created December 27, 2015 10:37
Wraps various os methods to be more forgiving.
'''
Wraps various os methods to be more forgiving.
:since: Dec 22, 2015
:author: Dustin Dorroh <dustin.dorroh@decisionsciencescorp.com>
'''
import os
import stat
@dustindorroh
dustindorroh / concat_df.py
Created December 27, 2015 10:35
Concatenate csv files using pandas DataFrames into one file
#!/usr/bin/env python2
'''
Concatenate csv files using pandas DataFrames into one file
:author: Dustin Dorroh <dustin.dorroh@decisionsciencescorp.com>
'''
import argparse
import pandas as pd
import os
# -*- mode: Conf -*-
[user]
name = Dustin Dorroh
email = dustindorroh@gmail.com
[core]
editor = emacs -nw
excludesfile = /home/ddorroh/.gitignore_global
[alias]
diff = diff --color
set history filename ~/.gdb_history
set history save
# do not bell on tab-completion
#set bell-style none
set bind-tty-special-chars off
set meta-flag on
set input-meta on
set convert-meta on
set output-meta on
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'