Skip to content

Instantly share code, notes, and snippets.

@ozkanpakdil
ozkanpakdil / aurora_setup.sh
Last active December 12, 2024 12:43
Create Aurora postgresql cluster where execution/query plans configured from scratch
#!/bin/bash
set -ex
# This script creates an Aurora PostgreSQL DB cluster and instance, applies a custom parameter group to enable auto explain for all queries/execution plans, and creates a database and user.
# It uses the AWS CLI to interact with Amazon RDS, and the `psql` command-line tool to execute SQL commands.
# Assumes that `psql` is installed and in the system PATH, and that AWS credentials are set as environment variables.
# Usage: ./PrepareAuroraPostgreSql.sh <SubnetGroupName>
@ozkanpakdil
ozkanpakdil / PrepareAuroraPostgreSql.ps1
Created December 11, 2024 19:51
Create aurora postgresql cluster for query/execution plans auto generated. fine tune log_min_duration and sample_rate otherwise it may fill up the logs too quick related to load.
# This script creates an Aurora PostgreSQL DB cluster and instance, applies a custom parameter group to enable auto explain for all queries/execution plans, and creates a database and user.
# It uses the AWS Tools for PowerShell module and the `aws` CLI to interact with Amazon RDS, and the `psql` command-line tool to execute SQL commands.
# Assumes that `psql` is installed and in the system PATH, and that AWS credentials are set as environment variables (from https://********.awsapps.com/start/#/?tab=accounts).
# Use the following command to run the script
# Use configured -SubnetGroupName which should allow Base monitor to connect to the Aurora PostgreSQL cluster
# .\PrepareAuroraPostgreSql.ps1 -SubnetGroupName XXXXXXX
param (
[Parameter(Mandatory=$true, HelpMessage="Enter the name of the subnet group.")]
[ValidateNotNullOrEmpty()]
added `implementation("net.logstash.logback:logstash-logback-encoder:8.0")` to build `build.gradle.kts`
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="OpenTelemetry"
class="io.opentelemetry.instrumentation.logback.appender.v1_0.OpenTelemetryAppender">
<captureExperimentalAttributes>true</captureExperimentalAttributes>
<captureKeyValuePairAttributes>true</captureKeyValuePairAttributes>
<captureCodeAttributes>true</captureCodeAttributes>
<captureMarkerAttribute>true</captureMarkerAttribute>
https://productionresultssa15.blob.core.windows.net/actions-results/1a35d4c9-75e9-47fc-92ea-cbe2a00c4dbc/workflow-job-run-ca395085-040a-526b-2ce8-bdc85f692774/logs/job/job-logs.txt?rsct=text%2Fplain&se=2024-03-17T23%3A05%3A39Z&sig=FofeP2rbb6fMpOHQG%2FSvSFkPOEp5QzI1HVFuw%2FLjV8s%3D&sp=r&spr=https&sr=b&st=2024-03-17T22%3A55%3A34Z&sv=2021-12-02
2024-03-17T22:06:38.4374548Z Current runner version: '2.314.1'
2024-03-17T22:06:38.4396587Z ##[group]Operating System
2024-03-17T22:06:38.4397181Z Ubuntu
2024-03-17T22:06:38.4397519Z 22.04.4
2024-03-17T22:06:38.4397939Z LTS
2024-03-17T22:06:38.4398245Z ##[endgroup]
2024-03-17T22:06:38.4398636Z ##[group]Runner Image
2024-03-17T22:06:38.4399133Z Image: ubuntu-22.04
oz-mint@ozmint-MACH-WX9:~/tmp/issues$ sdk install java 22.3.r19-grl
Downloading: java 22.3.r19-grl
In progress...
############################################################################################################################################################################################ 81.8%
############################################################################################################################################################################################# 82.1%
####################################################################################################################################################################################################################################### 100.0%
@ozkanpakdil
ozkanpakdil / graalvm native image extra options
Last active November 14, 2022 22:08
graalvm native image expert options
```bash
GraalVM 22.2.0 Java 17 CE (Java Version 17.0.4+8-jvmci-22.2-b06)
mintozzy@laptop:~$ native-image --expert-options-all
-H:±AOTInline Deprecated. Default: + (enabled).
-H:±AOTTrivialInline Perform trivial method inlining in the AOT compiled native image. Default: + (enabled).
-H:APIFunctionPrefix="graal_" Prefix that is added to the names of API functions.
-H:ASMInstructionProfiling=... Enables instruction profiling on assembler level. Valid values are a comma separated list of supported instructions.
Compare with subclasses of Assembler.InstructionCounter. Default: None
-H:±AbortOnBenchmarkCounterOverflow Abort VM with SIGILL if benchmark counters controlled by the (Generic|Timed|Benchmark)DynamicCounters. Default: -
(disabled). [Extra help available]
@ozkanpakdil
ozkanpakdil / stream and array sort
Last active May 26, 2022 22:13
java benchmark for stream api
```java
package com.example.demo;
import org.junit.jupiter.api.Test;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.openjdk.jmh.runner.options.TimeValue;
public int[] mergeTwoSortedIntArray(int[] foo, int[] bar) {
int fooLength = foo.length;
int barLength = bar.length;
int[] merged = new int[fooLength + barLength];
int fooPosition, barPosition, mergedPosition;
fooPosition = barPosition = mergedPosition = 0;
while (fooPosition < fooLength && barPosition < barLength) {
2021-06-16 11:51:38:372 +0100 [main] DEBUG nl.rvh.rulevalidation.TestBusinessRule - <?xml version="1.0" ?><nl.rvh.rulevalidation.BusinessRuleSet><name>Check Golden Cross</name><successResultApplicator class="nl.rvh.rulevalidation.applicators.LogApplicator"><parameters><entry><string>log</string><string>the result is SUCCESS!</string></entry></parameters></successResultApplicator><failResultApplicator class="nl.rvh.rulevalidation.applicators.LogApplicator"><parameters reference="../../successResultApplicator/parameters"></parameters></failResultApplicator><operator>AND</operator><businessRules><nl.rvh.rulevalidation.rules.MaGoldenCross><name>MaGoldenCross</name><successResultApplicator class="nl.rvh.rulevalidation.applicators.LogApplicator" reference="../../../successResultApplicator"></successResultApplicator><failResultApplicator class="nl.rvh.rulevalidation.applicators.LogApplicator" reference="../../../failResultApplicator"></failResultApplicator><comparisonOperator>GREATER_THAN</comparisonOperator><object
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
</head>