Skip to content

Instantly share code, notes, and snippets.

View AlexRogalskiy's full-sized avatar
🛰️
Work on stuff that matters

Alexander AlexRogalskiy

🛰️
Work on stuff that matters
View GitHub Profile
@AlexRogalskiy
AlexRogalskiy / clickhouse.sql
Last active April 15, 2024 09:41
db-refcard
--==========================================================================================
CREATE TABLE IF NOT EXISTS session_keys
(
key UInt32,
value String TTL INTERVAL 5 SECOND,
start_time DateTime
)
ENGINE = EmbeddedRocksDB
PRIMARY KEY key;
@AlexRogalskiy
AlexRogalskiy / types_and_roles_demo.sql
Created March 19, 2024 16:08 — forked from levlaz/types_and_roles_demo.sql
Create Types and Roles If Not Exist in PostgreSQL
BEGIN;
DO $$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'task_status') THEN
create type task_status AS ENUM ('todo', 'doing', 'blocked', 'done');
END IF;
END
$$;
CREATE TABLE IF NOT EXISTS
@AlexRogalskiy
AlexRogalskiy / api.mustache
Created January 30, 2024 15:47 — forked from erohana/api.mustache
openapi spring webflux server code generator
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) ({{{generatorVersion}}}).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package {{package}};
{{#imports}}import {{import}};
{{/imports}}
import io.swagger.annotations.*;
SELECT table,
formatReadableSize(sum(bytes)) as size,
min(min_date) as min_date,
max(max_date) as max_date
FROM system.parts
WHERE active
GROUP BY table
@AlexRogalskiy
AlexRogalskiy / LenientFutureCollector.java
Created January 15, 2024 17:34 — forked from dhet/LenientFutureCollector.java
Wait for the completion of multiple Java Futures or time out
import java.time.Duration;
import java.time.Instant;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.function.*;
import java.util.stream.Collector;
@AlexRogalskiy
AlexRogalskiy / GatewayApplication.java
Created January 5, 2024 00:57 — forked from WeirdBob/GatewayApplication.java
Spring cloud gateway response body modification
package examples;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@EnableAutoConfiguration
public class GatewayApplication {
@AlexRogalskiy
AlexRogalskiy / postman-collection.json
Last active December 21, 2023 12:39
Spec for Camunda REST API
{
"info": {
"name": "Camunda Rest API",
"_postman_id": "11c80602-f965-2a40-f2a4-ca62e8f31218",
"description": "",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "/deployment",
@AlexRogalskiy
AlexRogalskiy / Dockerfile
Created December 13, 2023 14:58 — forked from Slach/Dockerfile
clickhouse with odbc, for docker-compose and kubernetes
FROM yandex/clickhouse-server:${CLICKHOUSE_VERSION:-latest}
USER root
ARG UBUNTU_NAME=focal
ARG UBUNTU_VERSION=20.04
RUN echo "Begin ODBC install" && \
#MySQL repo
wget -qO- "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xa4a9406876fcbd3c456770c88c718d3b5072e1f5" | apt-key add - && \
echo "deb http://repo.mysql.com/apt/ubuntu/ ${UBUNTU_NAME} mysql-8.0" >/etc/apt/sources.list.d/mysql-oracle.list && \
@AlexRogalskiy
AlexRogalskiy / upstream.md
Created December 11, 2023 07:44 — forked from hackjutsu/upstream.md
[set upstream] What does '--set-upstream' do? #tags: git
git branch --set-upstream-to <remote-branch>
# example
git branch --set-upstream-to origin feature-branch

# show up which remote branch a local branch is tracking
git branch -vv

sets the default remote branch for the current local branch.

@AlexRogalskiy
AlexRogalskiy / snippets.txt
Created January 1, 2021 15:06
Zypper snippet samples
## add the swyear repository
sudo zypper ar Index of /repositories/home:/swyear/openSUSE_12.1
## package manager (zypper here) will resolve all dependencies and install them along with your required package.
zypper install telnet
## Add the Budgie repository to your system
zypper addrepo http://download.opensuse.org/repositories/home:ikeydoherty:evolve/openSUSE_13.2/home:ikeydoherty:evolve.repo
## refresh your package manager.
zypper refresh