Output to stdout:
tesseract doc.png stdout
Output to stdout, and assume only digits:
#!/bin/bash | |
# Automate the CAC Uninstall doc on MilitaryCAC.org for Macs | |
# http://militarycac.org/macuninstall.htm | |
RM="echo rm " | |
RM="rm" | |
declare -a OPENS=( | |
"/Applications/Utilities/Centrify/SmartCardTool" | |
"/Applications/Utilities/Centrify/SmartCardAssist" |
import boto3 | |
import botocore | |
from time import gmtime, strftime | |
FORMAT = "[%(levelname)s %(asctime)s %(filename)s:%(lineno)s - %(funcName)21s() ] %(message)s" | |
DATEFMT= strftime("%%Y%m%dT%H%M%SZ", gmtime()) logging.basicConfig(level=logging.DEBUG, format=FORMAT, datefmt=DATEFMT) | |
logger = logging.getLogger(__name__) | |
boto3_log = logging.getLogger("boto3") | |
boto3_log.setLevel(logging.DEBUG) |
var AWS = require('aws-sdk'); | |
var fs = require('fs'); | |
var bucketName = 'my-bucket-name'; | |
var bucketRegion = 'us-gov-west-1'; | |
var file = 'PDFSCANS/AGILE_5_page.pdf'; | |
var key = 'doc_pdf/CHRISJSnocreds.pdf'; | |
AWS.config.update({ | |
region: bucketRegion |
"""Get all doc ids and delete them to provide a clean index for demos, etc.""" | |
import os | |
import sys | |
from aws_requests_auth.aws_auth import AWSRequestsAuth | |
from elasticsearch import Elasticsearch, RequestsHttpConnection | |
try: | |
es_index = sys.argv[1] |
#!/usr/bin/env perl | |
# Read a range of bytes from HTTP file | |
use LWP; | |
my $url = 'http://example.com/alex.jpg'; | |
my $browser = LWP::UserAgent->new; | |
my @ns_headers = ('Range' => 'bytes=0-80'); | |
my $response = $browser->get($url, @ns_headers); | |
print "Resp content:", $response->content; |
#!/usr/bin/env python | |
# | |
# If you do not set MetadataDirective=REPLACE the managed copy will NOT set the | |
# CacheControl on the copy, nor will it warn you your attributes are being | |
# ignored. That is, unless the source is large enough to trigger the | |
# MultipartUpload, which will in fact set the CacheControl. This behavior | |
# difference based on size is -- to say the least -- surprising. | |
# See kyleknap's comment: https://github.com/aws/aws-cli/pull/1188 | |
# | |
# Note that when using REPLACE (on "small" files) it will replace all metadata |
# Create AWS ElasticTranscoder preset based on AWS 1080p with 'auto' framerate. | |
# This uses same output FPS as incoming, so we don't up/down sample. | |
import boto3 | |
et = boto3.client('elastictranscoder') | |
res = et.read_preset(Id='1351620000001-000001') # Generic 1080p | |
preset = res['Preset'] | |
del preset['Type'] |
def asset_update(asset_id, state, extra={}): | |
asset = extra.copy() | |
asset.update({'dt': datetime.now().isoformat(), | |
'state': state}) | |
# We need update_item placeholder and values like: | |
# UpdateExpression='SET dt = :dt, #state = :state' # 'state' is a reserved word | |
# ExpressionAttributeNames={'#state': 'state'} # proxy for reserved word 'state' | |
# ExpressionAttributeValues={':dt': datetime.now().isoformat(), ':state': 'uploaded'} | |
# We can't use "reserved words" like 'state' use EAN for *all* names, |
aws_region = config['AWS']['region'] | |
search_domain_name = config['AWS']['cloudsearch_domain_name'] # e.g., avail-search-dev | |
cs = boto3.client("cloudsearch") | |
cs_domain = cs.describe_domains(DomainNames=[search_domain_name])['DomainStatusList'][0] | |
cs_doc_ep = cs_domain['DocService']['Endpoint'] | |
cs_doc = boto3.client('cloudsearchdomain', | |
endpoint_url='https://' + cs_doc_ep, | |
region_name=aws_region) | |
cs_search_ep = cs_domain['SearchService']['Endpoint'] | |
cs_search = boto3.client('cloudsearchdomain', |