https://www.postgresql.org/docs/9.5/static/reference-client.html
SHOW work_mem;| import cv2.cv as cv | |
| import tesseract | |
| gray = cv.LoadImage('captcha.jpeg', cv.CV_LOAD_IMAGE_GRAYSCALE) | |
| cv.Threshold(gray, gray, 231, 255, cv.CV_THRESH_BINARY) | |
| api = tesseract.TessBaseAPI() | |
| api.Init(".","eng",tesseract.OEM_DEFAULT) | |
| api.SetVariable("tessedit_char_whitelist", "0123456789abcdefghijklmnopqrstuvwxyz") | |
| api.SetPageSegMode(tesseract.PSM_SINGLE_WORD) | |
| tesseract.SetCvImage(gray,api) | |
| print api.GetUTF8Text() |
| __author__ = 'dkarchmer' | |
| ''' | |
| This script emulates a stand-alone Python based client. It relies on Boto3 to access AWS, but | |
| requires your Django server to have an API for your user to access Cognito based credentials | |
| Because of Cognito, the client (this script) will only get temporary AWS credentials associated | |
| to your user and only your user, and based on whatever you configure your AIM Policy to be. | |
| Most Cognito examples demonstrate how to use Cognito for Mobile Apps, so this scripts demonstrate | |
| how to create a stand-alone Python script but operating similarly to these apps. |
My objective is to have some production files ignored on specific branches. Git doesn't allow to do it.
My solution is to make a general .gitignore file and add .gitignore.branch_name files for the branches I want to add specific file exclusion.
I'll use post-checkout hook to copy those .gitignore.branch_name in place of .git/info/exclude each time I go to the branch with git checkout branch_name.
| // Here is an extremely simple version of work scheduling for multiple | |
| // processors. | |
| // | |
| // The Problem: | |
| // We have a lot of numbers that need to be math'ed. Doing this on one | |
| // CPU core is slow. We have 4 CPU cores. We would thus like to use those | |
| // cores to do math, because it will be a little less slow (ideally | |
| // 4 times faster actually). | |
| // | |
| // The Solution: |
| >>> from django.contrib.auth.models import User | |
| >>> ContentType.objects.get_for_model(User) | |
| <ContentType: user> | |
| from django.contrib.contenttypes.models import ContentType | |
| from auditlog.models import LogEntry | |
| import json | |
| def get_LogEntry_Journal(self, model, field_name): | |
| content_type = ContentType.objects.get_for_model(model) |
| from __future__ import unicode_literals | |
| import threading | |
| import time | |
| from django.conf import settings | |
| from django.db.models.signals import pre_save | |
| from django.utils.functional import curry | |
| from django.apps import apps | |
| from auditlog.models import LogEntry |
| class ApplyCredit(APIView): | |
| permission_classes = [IsAuthenticated] | |
| def post(self, request): | |
| """ | |
| Apply credit on bill.com | |
| """ | |
| try: | |
| audit_log = AuditLog(user=request.user) | |
| billee_id = request.POST.get('billee_id') |