in gnu-like systems
sed -f rm-en-wordlist-on-lines.sed corpus.list > output.file
should suffice, however on OSX, it may be required to run sed like this:
| #!/usr/bin/env bash | |
| # fetch_nike_puls_all_activities.bash | |
| # A simple bash script to fetch all activities and metrics from NikePlus. | |
| # See `nike_plus_api.md` for the API details. | |
| readonly bearer_token="$1" | |
| if [[ -z "$bearer_token" ]]; then | |
| echo "Usage: $0 bearer_token" | |
| exit |
| #!/usr/bin/env/python | |
| import psycopg2 | |
| import os | |
| from io import StringIO | |
| import pandas as pd | |
| # Get a database connection | |
| dsn = os.environ.get('DB_DSN') # Use ENV vars: keep it secret, keep it safe | |
| conn = psycopg2.connect(dsn) |
Random query recipes of JMESPath for the AWS CLI tools that I might have written or stumbled upon.
John Obelenus, jobelenus@activefrequency.com
class BaseJsonWebsocketConsumer(JsonWebsocketConsumer):
def send(self, content, close=False):
"""
| # A virtualenv running Python3.6 on Amazon Linux/EC2 (approximately) simulates the Python 3.6 Docker container used by Lambda | |
| # and can be used for developing/testing Python 3.6 Lambda functions | |
| # This script installs Python 3.6 on an EC2 instance running Amazon Linux and creates a virtualenv running this version of Python | |
| # This is required because Amazon Linux does not come with Python 3.6 pre-installed | |
| # and several packages available in Amazon Linux are not available in the Lambda Python 3.6 runtime | |
| # The script has been tested successfully on a t2.micro EC2 instance (Root device type: ebs; Virtualization type: hvm) | |
| # running Amazon Linux AMI 2017.03.0 (HVM), SSD Volume Type - ami-c58c1dd3 | |
| # and was developed with the help of AWS Support |
| import Vision | |
| //1 | |
| let sourceImage = UIImage(named: "jony.jpg") | |
| var resultImage = sourceImage | |
| //2 | |
| let detectFaceRequest = VNDetectFaceLandmarksRequest { (request, error) in | |
| //4 | |
| if let results = request.results as? [VNFaceObservation] { | |
| //5 | |
| for faceObservation in results { |
| from io import BytesIO | |
| import gzip | |
| import shutil | |
| def upload_gzipped(bucket, key, fp, compressed_fp=None, content_type='text/plain'): | |
| """Compress and upload the contents from fp to S3. | |
| If compressed_fp is None, the compression is performed in memory. | |
| """ |
| import smtplib | |
| import os | |
| def send_email(host, port, username, password, subject, body, mail_to, mail_from = None, reply_to = None): | |
| if mail_from is None: mail_from = username | |
| if reply_to is None: reply_to = mail_to | |
| message = """From: %s\nTo: %s\nReply-To: %s\nSubject: %s\n\n%s""" % (mail_from, mail_to, reply_to, subject, body) | |
| print (message) | |
| try: |
| import pandas as pd | |
| import numpy as np | |
| import re | |
| # ================================================ | |
| class option_parser: | |
| def __init__(self, symbol, response): | |
| self.symbol = symbol | |
| self.response = response | |
| # ------------------------------------------------ |