Skip to content

Instantly share code, notes, and snippets.

View SergiusAC's full-sized avatar

Sergey Ch. SergiusAC

  • Kazakhstan, Nur-Sultan
View GitHub Profile
@SergiusAC
SergiusAC / QueryStringParser.java
Created May 11, 2025 17:38
Validate Telegram Mini App Init Data in Java
import org.apache.commons.lang3.StringUtils;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.*;
public class QueryStringParser {
/**
* Make a map from a string like "key1=val1&key2=val2".
@SergiusAC
SergiusAC / yieder.py
Created November 23, 2023 09:04 — forked from homm/yieder.py
import time
import collections
import functools
import itertools
TIMES = 200
N = 200
M = 10
@SergiusAC
SergiusAC / nginx-minio-static.md
Created January 8, 2022 08:11 — forked from harshavardhana/nginx-minio-static.md
How to configure static website using Nginx with MinIO ?

How to configure static website using Nginx with MinIO ?

1. Install nginx

2. Install minio

3. Install mc client

4. Create a bucket:

$ mc mb myminio/static
Bucket created successfully ‘myminio/static’.
@SergiusAC
SergiusAC / uninstall_certain_pkgs_by_time_day.txt
Created October 20, 2020 13:41
Linux command to uninstall (purge) all packages installed at a certain time/day
grep "2015-12-19.*.install " /var/log/dpkg.log | awk '{ print $4 }' | cut -d: -f1 | xargs sudo apt-get --yes purge
version: '3'
networks:
vpcbr:
driver: bridge
ipam:
config:
- subnet: 10.5.0.0/16
services:
@SergiusAC
SergiusAC / tokens.md
Created May 26, 2020 23:15 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 20.04.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@SergiusAC
SergiusAC / docker-compose.yml
Last active May 23, 2020 21:01
Kafka Cluster using docker-compose
version: "2"
networks:
kafka-net:
driver: bridge
services:
burrow:
image: "solsson/burrow:latest"
networks:
@SergiusAC
SergiusAC / test_mpi.cpp
Created July 8, 2019 21:03
MPI testing
#include <mpi.h>
#include <cstdio>
template<class T>
class ITask
{
public:
ITask();
ITask(const ITask &);
virtual void Run(T);
__kernel void saxpy(__global float *x, __global float *y, float a)
{
const int i = get_global_id(0);
y[i] += a * x[i];
}
@SergiusAC
SergiusAC / test_openmp.cpp
Last active July 7, 2019 11:46
OpenMP testing
#include "omp.h"
#include <iostream>
#include <ctime>
typedef long long lli_t;
lli_t sum_array(const lli_t *a, const lli_t n)
{
lli_t sum = 0;
for (lli_t i = 0; i < n; i++) {