This file contains 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
# Amazon Linux 2023 | |
# pgsql 15 | |
sudo yum install readline-devel lz4-devel postgresql15-static postgresql15-server-devel -y | |
sudo yum groupinstall "Development Tools" -y | |
wget --no-check-certificate 'https://api.pgxn.org/dist/pg_repack/1.4.8/pg_repack-1.4.8.zip' | |
unzip pg_repack-1.4.8.zip | |
cd pg_repack-1.4.8 | |
make |
This file contains 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 smtplib, ssl | |
port = 465 # For SSL | |
smtp_server = "smtp.gmail.com" | |
sender_email = "sender@gmail.com" # Enter your address | |
receiver_email = "recv@gmail.com" # Enter receiver address | |
password = input("Type your password and press enter: ") | |
message = """\ | |
Subject: Hi there |
This file contains 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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "VisualEditor0", | |
"Effect": "Allow", | |
"Action": "s3:*", | |
"Resource": "*" | |
}, | |
{ |
This file contains 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 sys | |
from opensearchpy import OpenSearch, helpers | |
host = 'vpc-xxxx-cyz5i7xdfs3dffsdgerwerw.ap-northeast-1.es.amazonaws.com' | |
port = 443 | |
auth = ('admin', 'password?') # For testing only. Don't store credentials in code. | |
# Create the client with SSL/TLS enabled, but hostname verification disabled. | |
client = OpenSearch( |
This file contains 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 { Cluster } from "ioredis"; | |
const host = "clustercfg.test.xxxxxx.memorydb.ap-northeast-1.amazonaws.com"; | |
const port = 6379; | |
export const redis = new Cluster([{ host, port }], { | |
dnsLookup: (address, callback) => callback(null, address), | |
redisOptions: { | |
tls: {}, | |
}, |
This file contains 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 sagemaker | |
import boto3 | |
from sagemaker.huggingface import HuggingFaceModel, get_huggingface_llm_image_uri | |
try: | |
role = sagemaker.get_execution_role() | |
except ValueError: | |
iam = boto3.client('iam') | |
role = iam.get_role(RoleName='sagemaker_execution_role')['Role']['Arn'] |
This file contains 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 boto3 | |
import requests | |
import json | |
import urllib | |
BASE_URL = 'https://signin.aws.amazon.com/federation' | |
TARGET_URL = 'https://console.aws.amazon.com/' | |
def get_fedration_token(): | |
client = boto3.client('sts') | |
fid = client.get_federation_token( |
This file contains 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 boto3 | |
client = boto3.client('rds') | |
def modify_acu(cluster_id, min_acu, max_acu): | |
resp = client.modify_db_cluster( | |
DBClusterIdentifier=cluster_id, | |
ApplyImmediately=True, | |
ServerlessV2ScalingConfiguration={ |
This file contains 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
# | |
# Licensed to the Apache Software Foundation (ASF) under one | |
# or more contributor license agreements. See the NOTICE file | |
# distributed with this work for additional information | |
# regarding copyright ownership. The ASF licenses this file | |
# to you under the Apache License, Version 2.0 (the | |
# "License"); you may not use this file except in compliance | |
# with the License. You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 |
This file contains 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/python3 | |
""" | |
extras.py: Upscale PNG images in DIR_IN into DIR_OUT. | |
Usage: Set API_URL, DIR_IN, and DIR_OUT. Then run ./extras.py | |
For API documentation see: http://localhost:7860/docs#/ | |
""" | |
import sys | |
import io | |
import os |
NewerOlder