Skip to content

Instantly share code, notes, and snippets.

View congzhangzh's full-sized avatar
🎯
Focusing

Cong Zhang congzhangzh

🎯
Focusing
View GitHub Profile
@scyto
scyto / proxmox.md
Last active May 28, 2024 21:56
proxmox cluster proof of concept

ProxMox Cluster - Soup-to-Nutz

aka what i did to get from nothing to done.

note: these are designed to be primarily a re-install guide for myself (writing things down helps me memorize the knowledge), as such don't take any of this on blind faith - some areas are well tested and the docs are very robust, some items, less so). YMMV

Purpose of Proxmox cluster project

Required Outomces of cluster project

@MawKKe
MawKKe / cmake-cxx-mold-linking-howto.md
Last active May 17, 2024 13:13
How to try out the new "mold" linker with your CMake C/C++ project

How to try out the new mold linker with your CMake C/C++ project

Here is a quick how-to if you want to try out the new (supposedly fast) C/C++ linker https://github.com/rui314/mold

In this document I used Ubuntu-22.04 docker container with

  • GCC version 11.2.0
  • Clang version 14.0.0

1. Install mold :

Overview

This is a minimal example that shows the 4 main building-blocks needed to write concurrent/async coroutine code.

  1. A coroutine type that lets users write their coroutine logic and call and co_await other coroutines that they write. This allows composition of async coroutine code.

This example defines a basic task type that fulfills this purpose.

@lewissbaker
lewissbaker / async_coroutine_example.cpp
Created May 24, 2022 03:58
Implementation of minimal set of components for writing concurrent async coroutine code in C++20.
/////////////////////////////////////////////////////////////////////////
// This is a minimal example that shows the 4 main building-blocks needed to
// write concurrent/async coroutine code.
//
// 1. A coroutine type that lets users write their coroutine logic
// and call and co_await other coroutines that they write.
// This allows composition of async coroutine code.
//
// This example defines a basic `task<T>` type that fulfills this purpose.
//
@daymien
daymien / hetzner-dedicated-wipe-and-install-nixos-luks-raid-lvm.sh
Last active December 14, 2023 17:55
Insall NixOS form hetzner rescue system with LUKS RAID1 LVM
#!/usr/bin/env bash
# Installs NixOS on a Hetzner server, wiping the server.
#
# This is for a specific server configuration; adjust where needed.
#
# Prerequisites:
# * Update the script wherever FIXME is present
#
# Usage:
@davidfowl
davidfowl / MinimalAPIs.md
Last active May 18, 2024 18:28
Minimal APIs at a glance

Introduction

This proposal aims to define the memory model of Julia and to provide certain guarantees in the presence of data races, both by default and through providing intrinsics to allow the user to specify the level of guarantees required. This should allow native implementation in Julia of simple system primitives (like mutexes), interoperate with native system code, and aim to give generally explainable behaviors without incurring significant performance cost. Additionally, it strives to be general-purpose and yet clear about the user's intent—particularly with respect to ensuring that an atomic-type field is accessed with proper care for synchronization.

The last two points deserve particular attention, as Julia has always provided strong reflection and generic programming capabilities that has not been seen—in this synergy combination—in any other language. Therefore, we want to be careful to observe a distinction between the asymmetries of reading vs. writing that we have felt is often not given

@ADeltaX
ADeltaX / dllmain.cpp
Created March 22, 2021 17:54
Example for accessing SetWindowBand function via dll injection via explorer.exe
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <mutex>
//INSTALL DETOURS FROM NUGET! (or build from source yourself)
#include <detours.h>
//Definitions
typedef BOOL(WINAPI* SetWindowBand)(IN HWND hWnd, IN HWND hwndInsertAfter, IN DWORD dwBand);
typedef BOOL(WINAPI* NtUserEnableIAMAccess)(IN ULONG64 key, IN BOOL enable);
@bmdalex
bmdalex / RegistrationForm.spec.ts
Created January 24, 2021 21:57
RegistrationForm.spec.ts full test fine
import { createLocalVue, shallowMount } from '@vue/test-utils'
import { createBuilder, testData } from './RegistrationFormComponent.builder.js'
import RegistrationForm from './RegistrationForm.vue'
import { byTestId } from '@/utils/testUtils.js'
const localVue = createLocalVue()
const validEmail = 'somename@example.com'
const invalidEmail = 'invalid email'
const registerUserResponse = { status: 200 }
@j-fu
j-fu / twglmakie2.jl
Created January 12, 2021 17:45
twglmakie #2
### A Pluto.jl notebook ###
# v0.12.18
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local el = $(esc(element))