This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY: help | |
help: ## Prints this help message | |
@echo "Commands:" | |
@grep -F -h '##' $(MAKEFILE_LIST) \ | |
| grep -F -v fgrep \ | |
| sort \ | |
| grep -E '^[a-zA-Z_-]+:.*?## .*$$' \ | |
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-30s\033[0m %s\n", $$1, $$2}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"fmt" | |
"time" | |
) | |
func withinDuration(duration time.Duration, stream <-chan string) (<-chan struct{}, <-chan string) { | |
stopToken := make(chan struct{}, 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- if not exists index | |
SET @dbname = DATABASE(); | |
SET @tablename = "TABLENAME"; | |
SET @indexname = "INDEXNAME"; | |
SET @preparedStatement = | |
(SELECT IF (EXISTS | |
(SELECT COUNT(*) | |
FROM information_schema.statistics | |
WHERE (table_schema = @dbname) | |
AND (table_name = @tablename) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use DOCKER_BUILDKIT=1 | |
FROM golang:1.17.3-alpine3.14 AS build | |
ENV GO111MODULE on | |
# 1. Precompile the entire go standard library into the first Docker cache layer: useful for other projects too! | |
RUN --mount=type=cache,target=/root/.cache/go-build \ | |
CGO_ENABLED=0 GOOS=linux go install -v -installsuffix cgo -a std | |
WORKDIR /src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From dee28179a8d0e01e2ec4e2562014364162ad2e92 Mon Sep 17 00:00:00 2001 | |
From: Maxim Eryomenko <moeryomenko@gmail.com> | |
Date: Wed, 2 Jun 2021 13:50:44 +0300 | |
Subject: [PATCH] convert string to arithmetic type if possible | |
Resolves: https://stackoverflow.com/q/67793080/7821330 | |
Signed-off-by: Maxim Eryomenko <moeryomenko@gmail.com> | |
--- | |
.../nlohmann/detail/conversions/from_json.hpp | 220 ++++++++---------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static const unsigned values_group_1 = (1 << 1) | (1 << 2) | (1 << 3); | |
static const unsigned values_group_2 = (1 << 4) | (1 << 5) | (1 << 6); | |
static const unsigned values_group_3 = (1 << 7) | (1 << 8) | (1 << 9); | |
if ((1 << value_to_check) & values_group_1) { | |
// You found a match for group 1 | |
} | |
if ((1 << value_to_check) & values_group_2) { | |
// You found a match for group 2 | |
} | |
if ((1 << value_to_check) & values_group_3) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdbool.h> | |
#include <stddef.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
struct node { | |
int value; | |
struct node* next; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.20 FATAL_ERROR) | |
project(<project-name> CXX) | |
set(CMAKE_CXX_STANDARD 20) | |
set(CMAKE_CXX_STANDARD_REQUIRED ON) | |
# need for clangd. | |
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | |
# install module that speeds up the build process. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cmake -GNinja -H. -Bbuild -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER_LAUNCHER='/usr/bin/ccache' -DCMAKE_CXX_COMPILER_LAUNCHER='/usr/bin/ccache' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function parse_yaml { | |
local prefix=$2 | |
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034') | |
sed -ne "s|^\($s\):|\1|" \ | |
-e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \ | |
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | | |
awk -F$fs '{ | |
indent = length($1)/2; |