Skip to content

Instantly share code, notes, and snippets.

View tonjadwyer's full-sized avatar

Tonja Dwyer tonjadwyer

View GitHub Profile
@acdha
acdha / simple_cors_server.py
Last active July 11, 2024 02:36
Python 3: serve the current directory as HTTP while setting CORS headers for XHR debugging
#!/usr/bin/env python3
# encoding: utf-8
"""Use instead of `python3 -m http.server` when you need CORS"""
from http.server import HTTPServer, SimpleHTTPRequestHandler
class CORSRequestHandler(SimpleHTTPRequestHandler):
def end_headers(self):
self.send_header('Access-Control-Allow-Origin', '*')
@multidis
multidis / aws_s3_ls.sh
Last active March 22, 2024 07:30
List of files in a specific AWS S3 location in a shell script.
#!/bin/bash
# setup AWS CLI first
# http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-set-up.html
# configure AWS CLI (e.g. use IAM role for S3 access)
export AWS_DEFAULT_REGION=us-east-1
export AWS_ACCESS_KEY_ID=IDHERE
export AWS_SECRET_ACCESS_KEY=KeyHere