Skip to content

Instantly share code, notes, and snippets.

View Ginurx's full-sized avatar

Jeffrey Zhuang Ginurx

  • FriendTimes
  • Suzhou
View GitHub Profile
@noobnooc
noobnooc / cloudflare-worker-proxy.js
Last active June 21, 2024 11:01
cloudflare-worker-proxy
// Website you intended to retrieve for users.
const upstream = 'api.openai.com'
// Custom pathname for the upstream website.
const upstream_path = '/'
// Website you intended to retrieve for users using mobile devices.
const upstream_mobile = upstream
// Countries and regions where you wish to suspend your service.
@bylaws
bylaws / 1.md
Last active March 20, 2024 18:40
Qualcomm Vulkan Driver qgl_config.txt Format

Info

Qualcomm Vulkan drivers on Android store their internal settings in a config file located in /data/{vendor, misc}/gpu/qgl_config.txt. This format is completely undocumented by Qualcomm however it contains many settings that can be useful for developers. Detailed documentation on it can be found below however it should be noted that selinux needs to be disabled for apps running in the Android sandbox to access this file.

Syntax

; is a comment
key{=, \n, \r}value assigns a setting value (all are treated in the same way)

On <SDM845, key is the human-readable setting name but on SDM845 or greater key can also be the hash of the setting name, to enable support for the older behaviour the line 0x0=0x8675309 can be added to the top of the file.

Keys

@Myndex
Myndex / ForTheLuvOfColor.md
Last active June 18, 2024 18:35
A comparative look at Lab and Luv colorspaces, and LCh.

Where's The Luv?

An Examination of the CIELAB and CIELUV colorspaces.

It is exciting to see so many new color features for the CSS Color Module. There are nevertheless a couple items that resulted in a "raised eyebrow response". This Gist is mainly going to focus on one: the use of the LAB version of LCh instead of LUV LCh, which may be better suited for the task but appears to have been dismissed as if irrellevant.

I DISAGREE. Luv is in common use and very relevant, and LuvLCh or one of the several LuvLCh variants has distinct advantages over LabLCh for use cases such as choosing color for web content for displays.

Myth Destruction

@litesync
litesync / makeios
Created March 4, 2019 07:22
Compile libuv for iOS
#!/bin/bash
PLATFORMPATH="/Applications/Xcode.app/Contents/Developer/Platforms"
TOOLSPATH="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin"
export IPHONEOS_DEPLOYMENT_TARGET="8.0"
pwd=`pwd`
findLatestSDKVersion()
{
sdks=`ls $PLATFORMPATH/$1.platform/Developer/SDKs`
@iscgar
iscgar / realbasic-overlay-resolve.py
Created September 26, 2018 19:32
REALbasic (Xojo) Reverse-Engineering Helper Script
# IDA REALbasic reverse engineering helper script
# It seems that every version of REALbasic (Xojo) the loader
# has a different behaviour (especially with regard to parsing
# the imports table), so I'm documenting here that this script
# was created based on a 2009r5 executable.
# iscgar, 2018-09-26
#
# Based on the REALbasic OVERLAY resolver
# XpoZed @ http://nullsecurity.org, 2017-07-16
# http://www.nullsecurity.org/article/reverse_engineering_realbasic_applications
float D_GGX_Anisotropic(float at, float ab, float ToH, float BoH, float NoH) {
// Burley 2012, "Physically-Based Shading at Disney"
float a2 = at * ab;
vec3 d = vec3(ab * ToH, at * BoH, a2 * NoH);
return saturateMediump(a2 * sq(a2 / dot(d, d)) * (1.0 / PI));
}
float V_SmithGGXCorrelated_Anisotropic(float at, float ab, float ToV, float BoV,
float ToL, float BoL, float NoV, float NoL) {
// Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
@sebbbi
sebbbi / SinglePassMipPyramid.hlsl
Last active January 12, 2024 07:16
Single pass globallycoherent mip pyramid generation
// NOTE: Must bind 8x single mip RWTexture views, because HLSL doesn't have .mips member for RWTexture2D. (SRVs only have .mips member)
// NOTE: globallycoherent attribute is needed. Without it writes aren't guaranteed to be seen by other groups
globallycoherent RWTexture2D<float> MipTextures[8];
RWTexture2D<uint> Counters[8];
groupshared uint CounterReturnLDS;
[numthreads(16, 16, 1)]
void GenerateMipPyramid(uint3 Tid : SV_DispatchThreadID, uint3 Group : SV_GroupId, uint Gix : SV_GroupIndex)
{
[unroll]
@sobotka
sobotka / alexa_stanza
Last active February 25, 2022 06:24
Arri Wide Gamut to REC.709
- !<ColorSpace>
name: Alexa Wide Gamut LogC
family: ""
equalitygroup: ""
bitdepth: 32f
description: |
LogC Arri Wide Gamut to REC.709 Primaries
isdata: false
allocation: uniform
allocationvars: [0, 1]
@idbrii
idbrii / botw-cedec2017.md
Last active May 16, 2024 14:56
An inline image version of Matt Walker's translation of CEDEC 2017 talks by Nintendo
@SpineyPete
SpineyPete / tonemappers.glsl
Last active November 2, 2023 13:20
Tonemappers
#version 330
// Tonemapping
// -----------
// Some of these are attributed to certain games.
// But this is mostly secondhand info, so take it with a grain of salt.
vec3 Tonemap_Reinhard(vec3 x) {
// Simplest Reinhard tonemapper.