Skip to content

Instantly share code, notes, and snippets.

@jmgibson71
jmgibson71 / label_maker.py
Created February 15, 2021 14:40
Google vision document find
#!/usr/bin/python
from pathlib import Path
from datetime import datetime
from google.cloud import vision
LOG_PATH = Path("/home/me/logs")
PATH_TO_IMAGES = Path("/data/Pictures/Takeout")
client = vision.ImageAnnotatorClient()
@halberom
halberom / 00_play.yml
Last active October 17, 2017 23:16
ansible - copy module returns different keys depending on change status - inconsistent
---
- hosts: localhost
gather_facts: False
connection: local
vars:
foo: bar
tasks:
- name: first time - dest is changed, 'dest' is returned in results
# yes I'm using template, not copy, but the template action plugin calls the copy module...
template:
@rshk
rshk / build-docker-image.sh
Created August 29, 2016 17:40
build-docker-image.sh
#!/bin/bash
# Version tag needs to be dependent on all the files that will affect
# the generated image. Currently, only the dockerfile and Python
# requirements.
VERSION_TAG="$( sha1sum Dockerfile requirements/*.txt | sha1sum | cut -d' ' -f1 )"
echo "Image version: ${VERSION_TAG}"
echo "Commit SHA1: ${CIRCLE_SHA1}"
@kosiara
kosiara / setup_howto.txt
Last active April 21, 2017 03:42
Setup Facebook React-native sample (empty) project on Ubuntu
# author:
# @Bartosz Kosarzycki
#
sudo apt-get install npm
sudo npm install -g react-native-cli
sudo ln -s /usr/bin/nodejs /usr/bin/node
cd /home/user/your/project/path
react-native init AwesomeProject
cd AwesomeProject
@bitmand
bitmand / gist:c6b7332214d858130c52
Last active December 20, 2017 13:51
Salt Stack state for creating a uniq 2048-bit diffie hellman group
# Create a unique 2048 Diffie Hellman group
# https://weakdh.org
/etc/ssl/dhparams.pem:
cmd.run:
- name: openssl dhparam -out /etc/ssl/dhparams.pem 2048
- unless: test -f /etc/ssl/dhparams.pem
@tobiasmcnulty
tobiasmcnulty / generate_factories.py
Last active October 27, 2020 15:12
Django management command to generate factory-boy boilerplate factory definitions for all the models in a given app. The code is not intended to be usable right off the bat, it just provides a few sane defaults based on the structure of your models.
from django.core.management.base import BaseCommand, CommandError
from django.db.models import get_models, get_app, fields
from django.db.models.fields import related
class Command(BaseCommand):
help = """Generate factory-boy factories for the given app"""
def handle(self, *args, **options):
assert len(args) == 1, 'Must specify app name as first and only argument'