Skip to content

Instantly share code, notes, and snippets.

View rndD's full-sized avatar
🍎

Alexey Kalmakov rndD

🍎
View GitHub Profile
@rndD
rndD / makefile-help.sh
Created February 21, 2024 11:44
makefile help
#!/bin/bash
# This script displays help information for the Makefile.
# Usage: ./makefile-help.sh Makefile
# Based on https://medium.com/@vildmedpap/make-your-makefile-user-friendly-create-a-custom-make-help-target-88c9ef130879
# Set colors for output
color_off='\033[0m'
example_color='\033[32m'
target_color='\033[36m'
@rndD
rndD / isMonotonic.go
Created September 29, 2023 21:49
some leetcode problem, just to share in chat
func isMonotonic(nums []int) bool {
direction := 0
if len(nums) == 1 {
return true
}
for i := 0; i < len(nums); i++ {
@rndD
rndD / sendgrid-webhook-events.type.ts
Last active February 5, 2024 11:18
Sendgrid webhook events ts type
// @see https://docs.sendgrid.com/for-developers/tracking-events/event
// There are is a mistake in the offical doc. Category is array of strings. I took it from the real webhook call.
type BaseSendgridEvent = {
email: string;
timestamp: number;
'smtp-id': string;
category: string | string[];
sg_event_id: string;
sg_message_id: string;
@rndD
rndD / yarn-lock-versions-to-package.ts
Last active October 27, 2022 22:32
Script replaces all deps versions in all `package.json`s from `yarn.lock` (yarn version 3). It works with yarn monorepo setup. Run: `yarn add @yarnpkg/parsers && npx ts-node yarn-lock-versions-to-package.ts`
import fs from 'fs';
import { parseSyml } from '@yarnpkg/parsers';
import path from 'path';
let file = fs.readFileSync('yarn.lock', 'utf8');
let json = parseSyml(file);
// function make map with all packages and their versions.
@rndD
rndD / resume.json
Last active May 17, 2022 14:18
My CV 2022
{
"$schema": "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
"basics": {
"name": "Alexey Kalmakov",
"label": "Fullstack/DevOps open to relocation on a global level",
"image": "",
"email": "st00nsa@gmail.com",
"phone": "",
"url": "",
"summary": "I’m a full stack web developer / devops who can build apps and infrastracure from the ground up.",
@rndD
rndD / nc_log.sh
Created March 26, 2022 12:31
nc: listen 3000 and log
while true; do { echo -e 'HTTP/1.1 200 OK\r\n'; } | nc -l -p 3000 -c ; done
func pop(alist *[]int) int {
f := len(*alist)
rv := (*alist)[f-1]
*alist = append((*alist)[:f-1])
return rv
}
func calc(b int, a int, f string) int {
func minOperations(logs []string) int {
deep := 0
for _, log := range logs {
if log == "./" {
continue
}
if log == "../" {
if deep != 0 {
deep = deep - 1
@rndD
rndD / .js
Last active April 24, 2023 18:38
ATM
// Нужно написать функцию банкомат
// * первым аргументом ты передаешь ей сколько ты хочешь снять
// * вторым массив доступным банкнот в баномате
// Функция должна вернуть массив из банкнот сумма которых ровна первому аргументу
// Желательно вернуть как можно меньше банкнот, тоесть не выдавать 100 рублей по рублю если есть 10тки.
// Пример
atm(301, [100,50,20,5,1]) // => [100, 100, 100, 1]
@rndD
rndD / index.html
Created January 21, 2020 10:18 — forked from jenniferlynparsons/index.html
Early returns comparison (http://jsbench.github.io/#1fd9788db451f01d4b84e12bba8d706f) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Early returns comparison</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>