This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
/** | |
* Example Macrame script that fetches mastodon followers. | |
* | |
* https://macrame.fruitbat.studio/Installation.html | |
* https://github.com/gbhorwood/Macrame | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user www-data; | |
worker_processes auto; | |
pid /run/nginx.pid; | |
include /etc/nginx/modules-enabled/*.conf; | |
events { | |
worker_connections 768; | |
# multi_accept on; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
server_name <domain name>; | |
root "<path to repository>"; | |
index index.html index.htm index.php; | |
charset utf-8; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#### | |
# Upload one file to configured S3 bucket | |
# | |
# 20240418 gbh | |
# | |
# Accepts the path to the file to upload as its only command-line argument. Uploads | |
# to the S3 bucket configured in the 'Configuration' block below. | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import os | |
import sys | |
packages_path = os.path.join(os.path.split(__file__)[0], "packages") | |
sys.path.append(packages_path) | |
#---------------------------------- | |
# Handler functions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: mailinglist # NOTE: update this with your service name | |
provider: | |
name: aws | |
runtime: python3.7 | |
functions: | |
postSubscription: | |
handler: mailinglist.postSubscription | |
events: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def mungeBoto3Rds(response): | |
# get a list of all the rows of data returned | |
records = response.get('sqlStatementResults')[0].get('resultFrame').get('records') | |
# get a list of keys so that element 0 of keys is the name of the column for | |
# the data in element 0 of records | |
keysList = list(map(lambda i: str(i.get('name')), response.get('sqlStatementResults')[0].get('resultFrame').get('resultSetMetadata').get('columnMetadata'))) | |
# an empty list to hold our newly-munged data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sql = "select * from registrations" | |
awsSecretStoreArn=getDotEnv("AWSSECRETSTOREARN") | |
dbClusterOrInstanceArn=getDotEnv("DBCLUSTERORINSTANCEARN") | |
database=getDotEnv("DATABASE") | |
# call data-api to execute sql | |
response = client.execute_sql( | |
awsSecretStoreArn=awsSecretStoreArn, | |
database=database, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# import the boto modules | |
import botocore | |
import boto3 | |
# get our aws credentials from our .env file | |
aws_access_key_id = str(getDotEnv("ACCESS_KEY_ID")) | |
aws_secret_access_key = str(getDotEnv("SECRET_ACCESS_KEY")) | |
region_name = str(getDotEnv("REGION_NAME")) | |
# create the client of type 'rds-data' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getQueryStringElement(element, event, default=None): | |
if event is None: | |
return default | |
elif not('queryStringParameters' in event): | |
return default | |
if event['queryStringParameters'] is None: | |
return default | |
elif element in event['queryStringParameters']: | |
return event['queryStringParameters'].get(element) |
NewerOlder