Skip to content

Instantly share code, notes, and snippets.

View akolybelnikov's full-sized avatar
:octocat:
Code weaves a story, Of logic and creativity, Developer's art form.

andrei akolybelnikov

:octocat:
Code weaves a story, Of logic and creativity, Developer's art form.
  • Shell
  • Amsterdam, Netherlands
  • 00:25 (UTC +02:00)
  • X @rokkapi
View GitHub Profile
@akolybelnikov
akolybelnikov / git.sh
Created February 5, 2023 20:35
- move all files and directories into a subdirectory
git mv -k -n * /target
git mv -k -n * /target <- dry-run for preview
@akolybelnikov
akolybelnikov / IntToByteArray.go
Created December 5, 2022 11:00 — forked from ecoshub/IntToByteArray.go
golang integer to byte array and byte array to integer function
package main
import (
"fmt"
"unsafe"
)
func main(){
// integer for convert
num := int64(1354321354812)
@akolybelnikov
akolybelnikov / postgres-cheatsheet.md
Created November 30, 2022 12:27 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@akolybelnikov
akolybelnikov / .golangci.yml
Created November 11, 2022 11:18 — forked from maratori/.golangci.yml
Golden config for golangci-lint
# This code is licensed under the terms of the MIT license.
## Golden config for golangci-lint v1.50.1
#
# This is the best config for golangci-lint based on my experience and opinion.
# It is very strict, but not extremely strict.
# Feel free to adopt and change it for your needs.
run:
# Timeout for analysis, e.g. 30s, 5m.
@akolybelnikov
akolybelnikov / 1_simple.go
Created November 10, 2022 15:56 — forked from sosedoff/1_simple.go
Golang Custom Struct Tags Example
package main
import (
"fmt"
"reflect"
)
// Name of the struct tag used in examples
const tagName = "validate"
@akolybelnikov
akolybelnikov / 1-setup.md
Created July 7, 2022 22:13 — forked from troyfontaine/1-setup.md
Signing your Git Commits using GPG on MacOS

Methods of Signing with GPG on MacOS

Last updated June 23, 2022

There are now two ways to approach this:

  1. Using gpg and generating keys
  2. Using Kryptonite by krypt.co

This Gist explains how to do this using gpg in a step-by-step fashion. Kryptonite is actually wickedly easy to use-but you will still need to follow the instructions

@akolybelnikov
akolybelnikov / signing-git-commits.md
Created July 7, 2022 22:13 — forked from phortuin/signing-git-commits.md
Set up a GPG key for signing Git commits on MacOS (M1)

Based on this blogpost.

To sign Git commits, you need a gpg key. GPG stands for GNU Privacy Guard and is the de facto implementation of the OpenPGP message format. PGP stands for ‘Pretty Good Privacy’ and is a standard to sign and encrypt messages.

Setting up

Install with Homebrew:

$ brew install gpg
@akolybelnikov
akolybelnikov / playground.rs
Last active February 18, 2022 22:55 — forked from rust-play/playground.rs
Exercism Rust track: Sublist
#[derive(Debug, PartialEq)]
pub enum Comparison {
Equal,
Sublist,
Superlist,
Unequal,
}
fn convert_to_strings<T: PartialEq + std::fmt::Display>(_list: &[T]) -> String {
let str_vec: Vec<String> = _list
@akolybelnikov
akolybelnikov / rsa_sig_check.py
Created February 10, 2022 17:41 — forked from rondomondo/rsa_sig_check.py
Sign and Verify signature using a SSL certificate. I've been wanting to play around with various RSA signing methods. Particularly around JWT RSA signed tokens and verifying a sig using the public key extracted from a website certificate. Some of the nuances of it all can be a bit tricky. As part of my effort to get my head around it I cobbled t…
#!/usr/bin/env python
import argparse
import sys
import os
from datetime import datetime
from os import path
import pprint
from urllib3 import connection
def compress(raw: str) -> bytes:
bArr = raw.encode('utf-8')
print([b for b in bArr])
if len(bArr) == 1:
return bytes([1, bArr[0]])
rList = []
l = 0
while l < len(bArr):
count = 1