Skip to content

Instantly share code, notes, and snippets.

View dmikoss's full-sized avatar
🎯
Focusing

Dmitry Kostenkov dmikoss

🎯
Focusing
View GitHub Profile
@alexaandru
alexaandru / chi.go
Created February 14, 2024 16:40
Chi-like syntactic sugar layer on top of stdlib http.ServeMux
// Chi-like syntactic sugar layer on top of stdlib http.ServeMux.
package main
import (
"net/http"
"slices"
)
type (
middleware func(http.Handler) http.Handler
@saiyam1814
saiyam1814 / kubernetes-containerd.sh
Created July 25, 2022 08:42
kubernetes-containerd.sh
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
echo "step1"
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
echo "kubeadm install"
sudo apt update -y
sudo apt -y install vim git curl wget kubelet=1.24.3-00 kubeadm=1.24.3-00 kubectl=1.24.3-00
echo "memory swapoff"
sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
sudo swapoff -a
sudo modprobe overlay
@tuansoibk
tuansoibk / cryptography-file-formats.md
Last active October 21, 2025 14:06
Cryptography material conversion and verification commands
  1. Introduction
  2. Standards
  3. Common combinations
  4. Conversion
  5. Verification/Inspection
  6. Tips for recognising

Introduction

It happens that there are many standards for storing cryptography materials (key, certificate, ...) and it isn't always obvious to know which standard is used by just looking at file name extension or file content. There are bunch of questions on stackoverflow asking about how to convert from PEM to PKCS#8 or PKCS#12, while many tried to answer the questions, those answers may not help because the correct answer depends on the content inside the PEM file. That is, a PEM file can contain many different things, such as an X509 certificate, a PKCS#1 or PKCS#8 private key. The worst-case scenario is that someone just store a non-PEM content in "something.pem" file.

@0187773933
0187773933 / GolangSSHTunnelForwardAndReverse.go
Last active January 17, 2025 06:43
Golang SSH Forward and Reverse Tunnel
package main
import (
"context"
"fmt"
"os"
"os/signal"
"path"
"sync"
"syscall"
@Mau5Machine
Mau5Machine / docker-compose.yml
Last active July 17, 2025 20:13
Traefik Configuration and Setup
version: "3.3"
services:
################################################
#### Traefik Proxy Setup #####
###############################################
traefik:
image: traefik:v2.0
restart: always

Более удобной и актуальной версией является эта статья с использованием traefik

https://gist.github.com/dancheskus/365e9bc49a73908302af19882a86ce52


Certbot и nginx, как обратный прокси в Docker (пример с 2 react проектами)

В результате будет 2 react проекта на 1 сервере доступных по разным ссылкам

@esmevane
esmevane / index.tsx
Created November 7, 2018 04:24
[ Typescript / React / ProseMirror ]: Put React components into ProseMirror NodeViews
// This assumes Styled Components is in play, as well.
//
// Here we have the (too simple) React component which
// we'll be rendering content into.
//
class Underlined extends React.Component<any, any> {
public hole: HTMLElement | null
// We'll put the content into what we render using
@fnky
fnky / ANSI.md
Last active October 27, 2025 10:22
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@zeux
zeux / fastformat.hpp
Created July 5, 2018 20:01
A sketch of type-safe string formatter using C++11 variadic templates and, unlike fmtlib, focusing on minimal header size & compilation time.
#pragma once
#include <string>
namespace fmt {
#define KIND(X) \
X(bool,bool) \
X(signed char,schar) \
X(unsigned char,uchar) \
@gwihlidal
gwihlidal / NegativeViewportHeight.cpp
Last active March 16, 2023 09:35
Example of Vulkan negative viewport height extension
// With the VK_KHR_maintenance1 extension, you can specify negative viewport height.
// This allows negative height to be specified in the height field to perform a
// y-inversion of the clip-space to framebuffer-space transform. This allows you
// to avoid having to use gl_Position.y = -gl_Position.y, and makes porting to other
// APIs like DirectX12 much easier.
// You negate the height *and* move the "origin" to the bottom left.
// Unlike the original AMD extension which just negated height.
VkViewport viewport = {};