Skip to content

Instantly share code, notes, and snippets.

class CaptureBlurPreviewView: MTKView, AVCaptureVideoDataOutputSampleBufferDelegate {
private lazy var commandQueue = self.device?.makeCommandQueue()
private lazy var context: CIContext = {
guard let device = self.device else {
assertionFailure("The PreviewUIView should have a Metal device")
return CIContext()
}
return CIContext(mtlDevice: device)
}()
@AFutureD
AFutureD / config.json
Last active December 24, 2024 16:00
Swift LSP support for iOS on vscode
// .sourcekit-lsp/config.json
{
"swiftPM": {
"triple": "arm64-apple-ios",
"swiftCompilerFlags": [
"-sdk",
"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"
],
"cCompilerFlags": [
"-isysroot",
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
package *.gateway.fliter;
import lombok.RequiredArgsConstructor;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.cloud.gateway.support.ServerWebExchangeUtils;
import org.springframework.core.Ordered;
import org.springframework.http.MediaType;
import org.springframework.http.codec.HttpMessageReader;
import org.springframework.http.codec.ServerCodecConfigurer;
@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/"
}