Skip to content

Instantly share code, notes, and snippets.

View DarcJC's full-sized avatar

Darc Z. DarcJC

View GitHub Profile
@DarcJC
DarcJC / loader.py
Last active August 2, 2021 11:49
Casbin Policy Auto Reloader
"""
Current version(1.1.7) of AsyncCasbin doesn't support any async orm adapter,
it means adapter such as casbin_tortoise_adapter wouldn't work with the SyncedEnforcer class
(you will recieve "... was never awaited" if you use it ).
So we could just use common Enforcer, and reload the policy periodically(the strategy SyncedEnforcer choose).
"""
import casbin
import casbin_tortoise_adapter
@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active July 22, 2024 17:46
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized
@jonvaldes
jonvaldes / test.rs
Last active February 16, 2021 09:08
Testing how to generate a tga image with Rust
use std::io;
use std::fs::File;
use std::io::Write;
use std::mem;
use std::slice;
#[derive(Clone)]
struct Color(u8, u8, u8);
struct Image {
#include <cstdint>
#include <algorithm>
#include <iostream>
#include <limits>
namespace anh {
namespace detail {
/// @TODO Remove quotes from around constexpr when visual studio begins
/// supporting that c++0x feature.