sudo yum -y update
I'm not a big fan of their default bash prompt:
echo "export PS1='[\D{%F %T}]\n\[\e]0;\w\a\]\[\e[32m\]\u:\[\e[33m\]\w\[\e[0m\]\n\$ '" >> ~/.bashrc
source ~/.bashrc
| :dependsOn org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1 | |
| import kotlinx.serialization.json.Json | |
| import kotlinx.serialization.json.JsonObject | |
| import kotlinx.serialization.json.JsonArray | |
| import kotlinx.serialization.json.JsonPrimitive | |
| import kotlinx.serialization.encodeToString | |
| java | |
| -XX:MaxRAM=<real mem sz in bytes, 10% over max-heap ?> -Xmx512m | |
| -XX:+UseCompressedOops -XX:ObjectAlignmentInBytes=8 | |
| -XXfullCompaction | |
| -XXtlaSize:1k | |
| -XX:+UseParallelGC | |
| -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 | |
| -XX:GCTimeRatio=2 | |
| -XX:AdaptiveSizePolicyWeight=90 | |
| -XXaggressive:opt |
| import java.util.*; | |
| import java.util.stream.Collectors; | |
| class Main { | |
| static record Record(String asin, String sid, String wid) {} | |
| public static void main(String[] args) { | |
| var m = | |
| Map.ofEntries( | |
| Map.entry("k1", List.of(new Record("a1", "s1", "w1"), new Record("a2", "s1", "w1"))), |
| from bottle import Bottle, get, post, run, request, response | |
| from datetime import datetime | |
| from functools import wraps | |
| import logging | |
| from logging.handlers import RotatingFileHandler | |
| logger = logging.getLogger("app") | |
| # set up the logger |
| case class MyIo[A](unsafeRun : () => A) { | |
| def map[B](f: A => B): MyIo[B] = MyIo(() => f(unsafeRun())) | |
| def flatMap[B](f: A => MyIo[B]): MyIo[B] = MyIo(() => f(unsafeRun()).unsafeRun()) | |
| } | |
| val printer = MyIo(() => println("how")) | |
| val doit = printer.flatMap( _ => printer) | |
| val other = printer.map( _ => println("w")) |
| aws application-autoscaling register-scalable-target --region REGION \ | |
| --service-namespace sagemaker \ | |
| --resource-id endpoint/ENDPOINT_NAME/variant/VARIANT_NAME \ | |
| --scalable-dimension sagemaker:variant:DesiredInstanceCount \ | |
| --min-capacity MIN_VALUE \ | |
| --max-capacity MAX_VALUE | |
| target_tracking_json='{"TargetValue": SCALING_VALUE, "PredefinedMetricSpecification": {"PredefinedMetricType": "SageMakerVariantInvocationsPerInstance"}}' | |
| echo $target_tracking_json > target_tracking_scaling_policy.json |
| import { | |
| S3Client, | |
| PutObjectCommand, | |
| GetObjectAttributesCommand, | |
| GetObjectCommand, | |
| DeleteObjectCommand, | |
| ListObjectsV2Command, | |
| } from "@aws-sdk/client-s3"; |
| console.log('Loading function'); | |
| exports.handler = async (event) => { | |
| //console.log('Received event:', JSON.stringify(event, null, 2)); | |
| const fails = []; | |
| for (const { messageId, body } of event.Records) { | |
| console.log('SQS message %s: %j', messageId, body); | |
| fails.push(messageId); | |
| } |