Skip to content

Instantly share code, notes, and snippets.

View yujincheng08's full-sized avatar
🎯
Focusing

LoveSy yujincheng08

🎯
Focusing
View GitHub Profile
@vvb2060
vvb2060 / nexus2.http
Last active June 28, 2023 09:08
Maven Central Staging API
GET https://s01.oss.sonatype.org/service/local/staging/profile_repositories
Accept: application/xml
Authorization: basic {{basic}}
###
POST https://s01.oss.sonatype.org/service/local/staging/bulk/close
Accept: application/json
Content-Type: application/json
Authorization: basic {{basic}}
@Vogtinator
Vogtinator / README.md
Last active April 26, 2024 08:56
Run Win11 on ARM in QEMU

When following this guide on a host not capable of native arm64 KVM, replace -M virt -cpu host -accel kvm with -M virt,virtualization=on -cpu max.

The reason for virtualization=on is that the Windows bootloader does an smc #0 PSCI call, but without EL2, QEMU's TCG does not handle those because PSCI is in HVC mode and such that instruction is treated as undefined. With KVM enabled, smc #0 is handled properly.

Workaround in QEMU for using TCG without virtualization=on:

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index b871350856..de11ff51d1 100644
--- a/hw/arm/virt.c
@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) {}
@mingfang
mingfang / convert id_rsa to pem
Last active March 3, 2024 08:46
Convert id_rsa to pem file
openssl rsa -in ~/.ssh/id_rsa -outform pem > id_rsa.pem
chmod 600 id_rsa.pem
@korya
korya / Subfolder to git repo.md
Last active December 16, 2023 10:29
Convert subfolder into Git submodule