Skip to content

Instantly share code, notes, and snippets.

View deccer's full-sized avatar
👾

Josu Obzedat deccer

👾
View GitHub Profile
@deccer
deccer / arch-install-btrfs.sh
Created March 14, 2022 12:56
Arch Linux - Base Install Script - UEFI BTRFS
#!/bin/bash
set -e
set -o pipefail
set -o errtrace
set -o nounset
set -o errexit
KEYMAP='us'
LANG='en_US'
@deccer
deccer / arch-install-lvm-ext4.sh
Last active March 14, 2022 12:55
Arch Linux - Base Install Script - UEFI LVM EXT4
#!/bin/bash
set -e
set -o pipefail
set -o errtrace
set -o nounset
set -o errexit
KEYMAP='us'
LANG='en_US'
@deccer
deccer / Simple Deferred Renderering.md
Last active June 22, 2021 15:30
Simple Deferred Renderering

Simple Deferred Rendering

Framebuffer Setup

  • GBuffer

    GBuffer
    gBuffer1NormalsDepth nx ny nz depth Rgba16f

| gBuffer2AlbedoMaterialId | r | g | b | materialId | Rgba16f |

namespace DelegateTester
{
class Program
{
static void Main(string[] args)
{
if (SDLNative.Init(0x00000020u) < 0)
{
Console.WriteLine("SDL Init Failed");
}
Timer timer;
auto isRunning = true;
auto accumulator = 0.0f;
f32 currentTime = timer.elapsedMilliseconds();
auto lastTime = currentTime;
auto nextUpdate = lastTime + 1000;
loop:
while (isRunning)
{
@deccer
deccer / TexturePacker.cs
Last active January 12, 2021 18:09
Super naive Texture packing
class Tile
{
public int Id;
public int AtlasId;
public int AtlasPageIndex;
public float U0;
public float V0;
public float U1;
public float V1;
public float U2;
@deccer
deccer / RemoveSubmodule.md
Created November 27, 2020 11:02
Remove git submodule

Completely Remove Git Sub-Module

Two different methods to automate the process of removing a submodule from a git repo with a single command. Adapted from here.

NOTE: A commit is made during removal, so it is best to commit any other changes prior to executing the command.

Using as a script in your PATH (filename will be name of command)

  • Create a new file anywhere in your shell's search paths (i.e. ~/.local/bin)
  • Copy the following
@deccer
deccer / .editorconfig
Created September 1, 2020 04:13
.editorconfig
# To learn more about .editorconfig see https://aka.ms/editorconfigdocs
###############################
# Core EditorConfig Options #
###############################
root = true
# All files
[*]
indent_style = space
# Code files
[*.{cs,csx}]
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Rules for LpaDoc" Description="StyleCop Rules for LpaDoc" ToolsVersion="14.0">
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<Rule Id="CS1573" Action="None" /> <!-- -->
<Rule Id="CS1591" Action="None" /> <!-- -->
<Rule Id="CS1712" Action="None" /> <!-- -->
<Rule Id="SA0001" Action="None" /> <!-- All diagnostics of XML documentation comments has been disabled due to the current project configuration. -->
<Rule Id="SA1005" Action="None" /> <!-- A single-line comment within a C# code file does not begin with a single space. -->
<Rule Id="SA1026" Action="None" /> <!-- An implicitly typed array allocation within a C# code file is not spaced correctly. -->
<Rule Id="SA1101" Action="None" /> <!-- A call to an instance member of the local class or a base class is not prefixed with 'this.', within a C# code file. -->
public class NvOptimus
{
static readonly uint NvOptimusEnablement = 1;
private const uint PageReadwrite = 0x04;
private const uint GetModuleHandleExFlagUnchangedRefcount = 0x2;
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool VirtualProtect(IntPtr lpAddress, uint dwSize, uint flNewProtect, out uint lpflOldProtect);