This file contains hidden or 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 std::collections::HashMap; | |
use std::collections::hash_map::Entry; | |
use std::cmp::Eq; | |
#[derive(Debug)] | |
pub struct RawKV { | |
key: String, | |
value: String | |
} |
This file contains hidden or 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 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 | |
} |
This file contains hidden or 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
#!/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 |
This file contains hidden or 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
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) }); |
This file contains hidden or 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
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 |
This file contains hidden or 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 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 |
This file contains hidden or 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 <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; |
This file contains hidden or 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
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; | |
} |
This file contains hidden or 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
#!/usr/bin/env python | |
import argparse | |
import sys | |
import os | |
from datetime import datetime | |
from os import path | |
import pprint | |
from urllib3 import connection |
This file contains hidden or 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
#[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 |