Skip to content

Instantly share code, notes, and snippets.

version: '3.5'
services:
etcd:
container_name: milvus-etcd
image: quay.io/coreos/etcd:v3.5.5
environment:
- ETCD_AUTO_COMPACTION_MODE=revision
- ETCD_AUTO_COMPACTION_RETENTION=1000
- ETCD_QUOTA_BACKEND_BYTES=4294967296
package ;
import java.util.*;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
@AFutureD
AFutureD / config.yml
Created January 30, 2024 04:07
LazyGit Config
gui:
sidePanelWidth: 0.25
git:
paging:
colorArg: always
externalDiffCommand: 'difft --color=always --display="$([ $(tput cols) -lt 180 ] && echo inline || echo side-by-side-show-both)" --context=4' # side-by-side-show-both
# externalDiffCommand: tput cols
keybinding:
universal:
@RequiredArgsConstructor
public class Client {
public <T> Result<T> execute(Object requset, Class<?>... types) {
String content = <json response>
return JSONObject.parseObject(content, buildType(ArrayUtil.append(new Class[]{Result.class}, types)));
}
import Foundation
import XCTest
public protocol A {
var value: Int { get }
}
public protocol B {
associatedtype T: A
func check<T>(input: T) -> Int
@AFutureD
AFutureD / ring_aes_example.rs
Last active April 12, 2023 03:26
A example about how to use AES algorithm for ring.
# ring = "0.16.20"
use ring::*;
use ring::aead::{Aad, AES_128_GCM, BoundKey, Nonce, OpeningKey, SealingKey, UnboundKey};
static ALGORITHM: &aead::Algorithm = &AES_128_GCM;
struct OneNonceSequence(Option<aead::Nonce>);
impl OneNonceSequence {
fl () {
API=""
ret_json=$(curl -s -H "Content-Type: application/json" -X POST -d "{\"content\":\"$*\"}" $API)
echo $ret_json | sed "s/.*\"message\":\([^,}]*\).*/\1/"
}
@AFutureD
AFutureD / Hypothesis.user.js
Last active January 7, 2024 23:00
A Tempermonkey script for Hypothes.is
// ==UserScript==
// @name Hypothesis
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author AFuture
// @match *://*/*
// @grant none
// ==/UserScript==
@AFutureD
AFutureD / Inherit_Path.python
Created April 28, 2020 08:19
#Python #Inherit pathlib.Path
from pathlib import Path
class DataSetPath(type(Path())):
def __new__(cls, *args, **kwargs):
path = cls
return super().__new__(cls, *args, **kwargs)
def __mod__(self, other):
return self.parent / (str(self.name) % other)
@AFutureD
AFutureD / show mask on the image.py
Created January 16, 2020 03:37
Apple mask on a image.
def random_colors(self, N, bright=True):
"""
Generate random colors.
To get visually distinct colors, generate them in HSV space then
convert to RGB.
"""
brightness = 1.0 if bright else 0.7
hsv = [(i / N, 1, brightness) for i in range(N)]
colors = list(map(lambda c: colorsys.hsv_to_rgb(*c), hsv))
random.shuffle(colors)