Skip to content

Instantly share code, notes, and snippets.

View rndD's full-sized avatar
🍎

Alexey Kalmakov rndD

🍎
View GitHub Profile
@rndD
rndD / go_image_ex
Created December 28, 2014 17:08
A tour of GO: Exercise: Images
package main
import (
"code.google.com/p/go-tour/pic"
"image"
"image/color"
)
type Image struct{}
@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 / 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 / .gitconfig
Last active November 13, 2023 11:40
git config for 2022-2023
[user]
name = Alexey Kalmakov
email = st00nsa@gmail.com
[core]
mergeoptions = --no-ff
pager = less -r
[alias]
vlog = log --pretty='%h (%an) %s' --graph
st = status
co = checkout
@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 / go_reader_ex.go
Last active September 24, 2023 17:09
A tour of Go: Exercise: Readers
package main
import "code.google.com/p/go-tour/reader"
type MyReader struct{}
func (r MyReader) Read(bytes []byte) (int, error) {
for i := range bytes {
bytes[i] = 65
@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 / 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