Skip to content

Instantly share code, notes, and snippets.

View kg's full-sized avatar

Katelyn Gadd kg

View GitHub Profile
@nikAizuddin
nikAizuddin / limit-wsl2-cpu-and-memory.md
Last active June 18, 2022 10:03
Limit WSL2 CPU and Memory

Limit WSL2 CPU and Memory

Run the following command using powershell without as Administrator:

notepad "$env:USERPROFILE/.wslconfig"

Put the following lines if you want to limit your WSL2 to 4GB of RAM and 2 CPUs:

[wsl2]
@totallyRonja
totallyRonja / oklab.hlslinc
Created March 24, 2021 13:47
OkLab color conversion functions for hlsl
static const float3x3 lrgb2cone = {
0.412165612, 0.211859107, 0.0883097947,
0.536275208, 0.6807189584, 0.2818474174,
0.0514575653, 0.107406579, 0.6302613616,
};
static const float3x3 cone2lab = {
+0.2104542553, +1.9779984951, +0.0259040371,
+0.7936177850, -2.4285922050, +0.7827717662,
+0.0040720468, +0.4505937099, -0.8086757660,

Properly Running MotionMark On Firefox

TL;DR: to get accurate/useful numbers for MotionMark in Firefox you must set these flags in about:config and restart your browser:

layers.offmainthreadcomposition.frame-rate = 0 (defaults to -1)
privacy.reduceTimerPrecision = false (defaults to true)

The first enables "ASAP mode" which tells the browser to paint frames as much as possible, and the second disables an important Spectre security mitigation that reduces the precision.

@Laforeta
Laforeta / caddyfile
Created May 10, 2018 10:24
Simple caddyfile example with forward proxy
https://$domain:$port {
gzip
log /var/log/caddy.log
tls $email
forwardproxy {
basicauth $user $passwd
}
}

why doesn't radfft support AVX on PC?

So there's two separate issues here: using instructions added in AVX and using 256-bit wide vectors. The former turns out to be much easier than the latter for our use case.

Problem number 1 was that you positively need to put AVX code in a separate file with different compiler settings (/arch:AVX for VC++, -mavx for GCC/Clang) that make all SSE code emitted also use VEX encoding, and at the time radfft was written there was no way in CDep to set compiler flags for just one file, just for the overall build.

[There's the GCC "target" annotations on individual funcs, which in principle fix this, but I ran into nasty problems with this for several compiler versions, and VC++ has no equivalent, so we're not currently using that and just sticking with different compilation units.]

The other issue is to do with CPU power management.

@roy-t
roy-t / xna4_vs2017.md
Last active February 19, 2023 10:43
Install XNA 4.0 under Microsoft Visual Studio 2017

This guide will provide you with a workaround for using XNA in Visual Studio 2017. This will solve problems with the target files and Microsoft.Build.Framework.dll such as: Error loading pipeline assembly "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Microsoft.Build.Framework.dll"

  1. Download a modified version of the XNA vsix: https://mxa.codeplex.com/
  2. Unzip XNA Game Studio 4.0.vsix and replace the <Installation /> tag in extension.vsixmanifest with this:
 <Installation InstalledByMsi="false">
    <InstallationTarget Version="[12.0,16.0)" Id="Microsoft.VisualStudio.VSWinDesktopExpress" />
    <InstallationTarget Version="[12.0,16.0)" Id="Microsoft.VisualStudio.Pro" />
@alirobe
alirobe / reclaimWindows10.ps1
Last active April 26, 2024 17:59
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###
@jibsen
jibsen / bytes.md
Last active December 20, 2023 10:02
Ramblings about uint8_t and undefined behavior

Introduction

The C standard only specifies minimum limits for the values of character types and standard integer types. This makes it possible to generate efficient code on diverse architectures, but can pose problematic if your code expects the limits to match your development platform, or if you have to do low-level things.

Before C99, the usual way to solve this was to use typedef to declare synonyms

@charlesnicholson
charlesnicholson / gist:5f066d9f0ea2f7b484ac
Last active December 3, 2021 20:08
compile-time string concatenation
#include <cstdio>
namespace detail {
template<unsigned count, template<unsigned...> class meta_functor, unsigned... indices>
struct apply_range {
typedef typename apply_range<count - 1, meta_functor, count - 1, indices...>::result result;
};
template<template<unsigned...> class meta_functor, unsigned... indices>
struct apply_range<0, meta_functor, indices...> {
@flibitijibibo
flibitijibibo / SpriteBatchTest.cs
Created July 26, 2014 16:16
SpriteBatch Stress Test
/* SpriteBatch Stress Test
* Written by Ethan "flibitijibibo" Lee
* http://www.flibitijibibo.com/
*
* Released under public domain.
* No warranty implied; use at your own risk.
*/
using System;
using System.Diagnostics;