Skip to content

Instantly share code, notes, and snippets.

View yujincheng08's full-sized avatar
🎯
Focusing

LoveSy yujincheng08

🎯
Focusing
View GitHub Profile
@yujincheng08
yujincheng08 / CMakeLists.txt
Created April 11, 2024 15:13
Clang frontend crash
cmake_minimum_required(VERSION 3.28)
project(test CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_SCAN_FOR_MODULES ON)
add_library(test SHARED foo.cc)
target_sources(test
@yujincheng08
yujincheng08 / enc_str.cc
Last active October 17, 2023 13:58
Compile time encrypt string
#include "enc_str.h"
#include <cstdio>
static_assert(next_prime<next_prime<4>> == next_prime<4> && next_prime<4> == 5, "??");
static constexpr auto j = "I love vvb2060 and she's my wife."_senc;
static constexpr auto k = ".."_senc;
static constexpr auto l = j + k;
int main() {
@yujincheng08
yujincheng08 / Dockerfile
Created January 4, 2020 14:38
Unblock youku server dockerfile
FROM sameersbn/squid
ADD http://pac.uku.im/regex /opt/crx_url_list.txt
ADD https://gist.githubusercontent.com/zhuzhuor/6b50406a9040e5c0b79d/raw/5e22f4b94158baacbb2c8b314c47e7ba763bbf6d/squid.conf /etc/squid/squid.conf
EXPOSE 8888/tcp
@yujincheng08
yujincheng08 / timer.h
Last active June 1, 2019 03:44
Thread safe c++ Timer
#include <condition_variable>
#include <functional>
#include <memory>
#include <shared_mutex>
#include <thread>
#include <chrono>
template <class Rep, class Period> class Timer {
public:
using Callback = std::function<void()>;
@yujincheng08
yujincheng08 / enumerate.h
Created May 5, 2019 14:23
Python-like loop enumeration in C++
#include <tuple>
template <typename T> class enumerate {
struct iterator {
using iter_type = decltype(std::declval<T>().begin());
private:
friend class enumerate;
iterator(const std::size_t &i, const iter_type &iter)
: i_(i), iter_(iter) {}