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
| <?php | |
| /** | |
| * Extract response headers from curl result as array keyed by header name | |
| * | |
| * @param string $result Return from curl_exec() | |
| * @param CurlHandle $ch Return from curl_init() | |
| * @return array<string,string> | |
| */ | |
| function getCurlResponseHeaders(string $result, CurlHandle $ch): array { | |
| $headersString = substr($result, 0, curl_getinfo($ch, CURLINFO_HEADER_SIZE)); |
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
| <?php | |
| /** | |
| * Tailf | |
| * A pure PHP implementation of the linux command tail -f | |
| * | |
| * 20250722 gbh | |
| */ | |
| // duration for usleep |
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, |
NewerOlder