Skip to content

Instantly share code, notes, and snippets.

View schepelin's full-sized avatar

Maxim Schepelin schepelin

  • Booking.com
  • Amsterdam, Netherlands
View GitHub Profile
@schepelin
schepelin / list.md
Created May 25, 2022 09:43 — forked from ih2502mk/list.md
Quantopian Lectures Saved
ARG BASE_IMAGE=ekidd/rust-musl-builder:latest
FROM ${BASE_IMAGE} AS builder
ADD --chown=rust:rust src ./src
ADD --chown=rust:rust Cargo.lock Cargo.toml ./
RUN cargo build --release
# Bundle Stage
FROM gcr.io/distroless/cc-debian10
@schepelin
schepelin / arch-linux-install
Last active October 15, 2019 11:10 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# This assumes a wifi only system...
@schepelin
schepelin / System Design.md
Created May 21, 2019 11:10 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@schepelin
schepelin / postgres_queries_and_commands.sql
Created June 5, 2018 08:39 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@schepelin
schepelin / date_matches_crontab.sql
Created February 13, 2018 18:07 — forked from pokidovea/date_matches_crontab.sql
Stored Postgresql function to check, that given date matches crontab with 7 positions (s, m, h, d, m, dow, year).
CREATE OR REPLACE FUNCTION check_value_in_bounds(v int, min_v int, max_v int) RETURNS void AS $$
-- Checks if v is in bounds, else throws exception
BEGIN
IF v > max_v THEN
RAISE EXCEPTION 'value too high: % > %', v, max_v;
END IF;
IF min_v > v THEN
RAISE EXCEPTION 'value too low: % < %', v, min_v;
END IF;
@schepelin
schepelin / hh_2
Last active August 29, 2015 14:06
hh test
# coding: utf-8
def hh_2_brute_force(subsequence):
subsequence = str(subsequence)
limit = int('1'+subsequence) if subsequence.startswith('0') else int(subsequence)
sequence = ''.join([str(num) for num in range(1, limit+1)])
return sequence.index(subsequence)+1
# настрой себе линтер что бы видеть ошибки pep8