Skip to content

Instantly share code, notes, and snippets.

View UlyssesWu's full-sized avatar
💤
working til death

Ulysses UlyssesWu

💤
working til death
View GitHub Profile
@dr4k0nia
dr4k0nia / HInvokeHashGen.cs
Created May 22, 2023 18:43
Tool to generate Hashes for HInvoke
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
GetMethodHash("System.Reflection.Assembly", "Load");
@tzhao11
tzhao11 / oculus_quest_2_adjust_date_time_no_factory_reset.md
Last active June 2, 2024 02:46
Adjust oculus quest 2 system date and time without doing factory reset.

Adjust Oculus (Meta) Quest 2 System Date/Time without Doing Factory Reset

TL;DR

adb shell service call alarm 2 i64 {current unix epoch * 1000}

Background

@libChan
libChan / wsl_clash_proxy.sh
Last active June 25, 2024 06:55
WSL2使用clash for windows代理
# WSL通过Win访问网络,所以WSL的网关指向的是Windows,DNS服务器指向的也是Windows,设置WSL的proxy为win的代理ip+端口即可
# WSL中的DNS server在/etc/resolv.conf中查看,该文件是由/etc/wsl.conf自动生成的。
# 如果关闭了wsl.conf中自动生成resolve.conf并自行修改了resolve.conf,DNS nameserver并不是本机win ip
# 需要开启wsl.conf的自动生成,再运行以下命令
# https://zhuanlan.zhihu.com/p/153124468
# 添加到环境变量设置中,例如~/.zshrc
export hostip=$(cat /etc/resolv.conf |grep -oP '(?<=nameserver\ ).*')
export https_proxy="http://${hostip}:7890"
export http_proxy="http://${hostip}:7890"
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Text;
namespace IsEvenSourceGenerator
{
[Generator]
/// <summary>
/// Of 8 bytes.
/// A structure which represents an:
/// <see cref="System.Object"/>, <see cref="System.Array"/> or <see cref="System.String"/>.
/// </summary>
[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Explicit, Size = 8)]
public struct Invariant
{
[System.Runtime.InteropServices.FieldOffset(0)]
public System.Array Array;
@MickaelWalter
MickaelWalter / disassemble-luajit-v1.py
Created August 29, 2020 14:27
Quick&dirty verbose LuaJIT's bytecode version 1 disassembler
#!/usr/bin/env python3
import sys
import struct
import math
# Constants
# Internal (LEB128 buffer)
MAX_ULEB_SIZE = 256 # Maximum proto size here is 2^7^256
@RickStrahl
RickStrahl / ColorConsole.cs
Last active March 30, 2024 16:00
Color Console - a simple class to add color to .NET Console commands more easily.
using System;
using System.Text;
using System.Text.RegularExpressions;
namespace MainColorConsole
{
class Program
{
static void Main(string[] args)
{
@natowi
natowi / audio2midi.md
Last active June 21, 2024 10:20
List of open source audio to midi packages
@jaredpar
jaredpar / evilnames.cs
Created November 5, 2019 00:27
Evil async and await C# code
using System;
using System.Runtime.CompilerServices;
public class C {
async async await(await async) => await async;
}
[AsyncMethodBuilder(typeof(builder))]
class async {
public awaiter GetAwaiter() => throw null;
@BastianBlokland
BastianBlokland / binserialize.md
Last active November 30, 2023 02:53
Span<byte> based binary serialization
MIT License

Copyright (c) 2019 Bastian Blokland

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is