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 / playground.rs
Created October 6, 2019 20:46 — forked from rust-play/playground.rs
Code shared from the Rust Playground
use std::collections::HashMap;
use std::collections::hash_map::Entry;
use std::cmp::Eq;
#[derive(Debug)]
pub struct RawKV {
key: String,
value: String
}
@akolybelnikov
akolybelnikov / playground.rs
Created October 9, 2019 09:22 — forked from rust-play/playground.rs
Code shared from the Rust Playground
use crate::node::Node;
use serde_json::Value;
use serde::ser::{Serialize, SerializeMap, Serializer};
use json_patch::merge;
struct WrapDirectory<'a, T> {
name: &'a str,
value: &'a T
}
@akolybelnikov
akolybelnikov / netlify.sh
Created October 12, 2019 16:58 — forked from lightdiscord/netlify.sh
Rust and wasm and netlify
#!/usr/bin/env bash
set -e
cweb_version=0.6.16
cweb=https://github.com/koute/cargo-web/releases/download/$cweb_version/cargo-web-x86_64-unknown-linux-gnu.gz
curl -Lo cargo-web.gz $cweb
gunzip cargo-web.gz
chmod u+x cargo-web
@akolybelnikov
akolybelnikov / main.rs
Created January 18, 2020 18:17 — forked from AnthonyMikh/main.rs
Решение задачи №138 от UniLecs (Максимальная последовательность по модулю)
extern crate itertools;
use itertools::{Itertools, Either::*};
// Самый первый вариант — разбиваем массив
// на вектор отрицательных чисел и вектор положительных,
// а затем возвращаем тот, для которого абсолютная сумма элементов больше.
fn max_abs_sum_subset_1(arr: &[i32]) -> Vec<i32> {
let (neg, pos): (Vec<_>, Vec<_>) = arr.iter().cloned()
.partition_map(|x| if x < 0 { Left(x) } else { Right(x) });
@akolybelnikov
akolybelnikov / setup.sh
Created March 27, 2020 10:11 — forked from bradp/setup.sh
New Mac Setup Script
echo "Creating an SSH key for you..."
ssh-keygen -t rsa
echo "Please add this public key to Github \n"
echo "https://github.com/account/ssh \n"
read -p "Press [Enter] key after this..."
echo "Installing xcode-stuff"
xcode-select --install
@akolybelnikov
akolybelnikov / .gitconfig.aliases
Created April 21, 2020 12:49 — forked from crunchie84/.gitconfig.aliases
git alias for the win 💪
#
# Include this in your own .gitconfig by using the
# [include] directive with the path to this file
#
# [include]
# path = ~/.gitconfig.aliases
#
# If you don't have any existing includes, you can add this via the following command
#
# git config --global include.path ~/.gitconfig.aliases
@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;
@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 / 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 / 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