Skip to content

Instantly share code, notes, and snippets.

View Ginurx's full-sized avatar

Jeffrey Zhuang Ginurx

  • FriendTimes
  • Suzhou
View GitHub Profile
@BastienClement
BastienClement / gist:b34f14dd93381498a7a1
Created June 17, 2014 17:20
The CASC (Content Addressable Storage Container) Filesystem
---------------------------------------------------------------------
| The CASC (Content Addressable Storage Container) Filesystem |
| Warlords of Draenor Alpha, Build 6.0.1.18125 |
| Written April 14th, 2014 by Caali |
| Version 1.2 |
---------------------------------------------------------------------
Distribution and reproduction of this specification are allowed without
limitation, as long as it is not altered. Quotation in other works is
freely allowed, as long as the source and author of the quote are stated.
@MattRix
MattRix / RXLookingGlass.cs
Created November 3, 2014 21:09
This class wraps an internal Unity method that lets you to check if a ray intersects a mesh. Place it in an Editor folder.
using UnityEngine;
using UnityEditor;
using System.Collections;
using System;
using System.Linq;
using System.Reflection;
[InitializeOnLoad]
public class RXLookingGlass
{
@aras-p
aras-p / fbfetch.shader
Created May 11, 2015 09:39
Framebuffer fetch shader in Unity
#include "UnityCG.cginc"
#pragma vertex vert
#pragma fragment frag
// in practice: only compile for gles2,gles3,metal
#pragma only_renderers framebufferfetch
struct appdata_t {
float4 vertex : POSITION;
float2 texcoord : TEXCOORD0;
};
@evantoli
evantoli / GitConfigHttpProxy.md
Last active June 19, 2024 00:17
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

@BastienClement
BastienClement / BlizzAuth.cs
Created January 22, 2016 15:43
Blizzard Authenticator number generation
/// <summary>
/// 10^0..10^8 (NumDigits used in the HOTP)
/// </summary>
private static readonly int[] DigitsPower = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000};
private static int DynamicTruncate(byte[] hash)
{
int offset = hash[hash.Length - 1] & 15;
return ((hash[offset] & 127) << 24) + ((hash[offset + 1] & 255) << 16) + ((hash[offset + 2] & 255) << 8) +
@aras-p
aras-p / thoughts.md
Last active April 14, 2019 19:03
Thoughts on depth texture in forward rendering in Unity

"Any thoughts on pulling a depth texture directly from a forward camera after opaque passes rather than using the pre pass?" (https://twitter.com/bgolus/status/747967191278989312)

Yeah, so there's several things that might complicate this:

  1. Screenspace ("deferred") shadows. These need depth texture, but you want to receive shadows while rendering opaque objects. So a depth pre-pass is the only option there. What we could do: remove (or make optional) the screenspace shadows; just directly sample & blend shadow cascades inside the shader. Increases register pressure, but has quite some benefits too (MSAA "just works", can do receiver plane bias, just works on transparencies etc.)
  2. Various "not quite standard" cases, like splitscreen cameras or other types of cameras that don't render to the whole render target. Probably not a common case though; if you have shadows & need depth, you likely also have postprocessing etc. So you're not rendering
@tomykaira
tomykaira / Base64.h
Last active June 7, 2024 14:41
C++ single header base64 decode/encoder for C++ 11 and above.
#ifndef _MACARON_BASE64_H_
#define _MACARON_BASE64_H_
/**
* The MIT License (MIT)
* Copyright (c) 2016-2024 tomykaira
*
* 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
@aayubkh
aayubkh / huawei_e8372_config.md
Last active February 13, 2024 11:55
Huawei E8372 Linux Configuration and Setup

Dependencies

  1. usb_modeswitch, usb_modeswitch-data
  2. libusb1
  3. libusb-devel(Fedora), libusb-dev(Debian based)

Configuration

By default, your linux box would register your Huawei E8372 as a Mass Storage device and not (somehow) as a modem. First, make sure you have the exace same device we're talking about. This can be confirmed by looking at two values using the following command (while the dongle is plugged in): As an elevated user:

    # lsusb | grep Huawei
@acamino
acamino / README.md
Last active June 17, 2024 03:03
Shortcuts to Improve Your Bash & Zsh Productivity

Shortcut — Action

  • CTRL + A — Move to the beginning of the line
  • CTRL + E — Move to the end of the line
  • CTRL + [left arrow] — Move one word backward (on some systems this is ALT + B)
  • CTRL + [right arrow] — Move one word forward (on some systems this is ALT + F)
  • CTRL + U — (bash) Clear the characters on the line before the current cursor position
  • CTRL + U —(zsh) If you're using the zsh, this will clear the entire line
  • CTRL + K — Clear the characters on the line after the current cursor position
  • ESC + [backspace] — Delete the word in front of the cursor
@ChrisWellsWood
ChrisWellsWood / empty_rust_structs.md
Last active November 8, 2023 10:05
Initialising empty structs in Rust.

Initialising Empty Structs in Rust

In C/C++, you can initialise a struct without giving values for any of the fields:

struct Point {
  float x;
  float y;
  float z;
};