Skip to content

Instantly share code, notes, and snippets.

View akolybelnikov's full-sized avatar
:octocat:
Building the future, one line of code at a time. 🚀

reddree akolybelnikov

:octocat:
Building the future, one line of code at a time. 🚀
View GitHub Profile
@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
@akolybelnikov
akolybelnikov / longest_incrementing_subslice.rs
Last active November 9, 2020 13:13 — forked from rust-play/playground.rs
Code shared from the Rust Playground
fn find_subseq(s: &[u8]) -> u8 {
let mut res: u8 = 1;
let mut i = 0;
while (i < s.len() - 1) && s[i] < 255 && (s[i] + 1 == s[i + 1]) {
res += 1;
i += 1;
}
return res;
}
@akolybelnikov
akolybelnikov / terminate-worker-threads.c
Created June 6, 2020 00:23 — forked from mfukar/terminate-worker-threads.c
C11 code to have a POSIX multithreaded application which signal work completion via a condition variable, and then terminate.
#include <unistd.h>
#include <stdbool.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#define NUM_THREADS 10
pthread_mutex_t cv_mutex;
pthread_cond_t notification_cv;