Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Octocating

Gleb Skibitsky skibitsky

:octocat:
Octocating
View GitHub Profile
@skibitsky
skibitsky / BiasDiffuse.shader
Created Feb 23, 2021
Simple diffuse surface shader with mip map bias support
View BiasDiffuse.shader
Shader "Futuclass/BiasDiffuse"
{
Properties
{
_MainTex ("Base (RGB)", 2D) = "white" {}
_MainTexBias ("Mip Bias", float) = -0.5
}
SubShader
{
Tags
@skibitsky
skibitsky / Billboard.shader
Last active Feb 19, 2021
Best billboard shader. Transparency, rotation, scale, optional "render on top".
View Billboard.shader
Shader "Futuclass/Billboard"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
[Enum(Yes, 0, No, 4)] _ZTest("Render on top", Int) = 4
}
SubShader
{
Tags{ "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" "DisableBatching" = "True" }
@skibitsky
skibitsky / VR_ScreenFader.shader
Last active Jul 25, 2020
Stereo Single Pass Screen Fading Shader
View VR_ScreenFader.shader
Shader "Custom/ScreenFader"
{
Properties
{
_MainTex("Texture", 2D) = "white" {}
_FadeColor ("Color", Color) = (0,0,0,0)
_Intensity ("Intensity", float) = 0
}
SubShader
View Hibernate (change sleep mode).sh
Sleep modes:
hibernatemode = 0 (binary 0000) by default on supported desktops. The
system will not back memory up to persistent storage. The system must
wake from the contents of memory; the system will lose context on power
loss. This is, historically, plain old sleep.
hibernatemode = 3 (binary 0011) by default on supported portables. The
system will store a copy of memory to persistent storage (the disk), and
will power memory during sleep. The system will wake from memory, unless
View Unity Vector3 and Quaternion (De)Serialization Extension
using System;
using UnityEngine;
namespace Salday.UnityExtensions
{
public static class SerializationExtesions
{
public static byte[] SerializeQuaternion(this Quaternion quat)
{
byte[] arr = new byte[16];
@skibitsky
skibitsky / MacBookInput.ahk
Last active Oct 31, 2019
MacBook Input macro for AutoHotkey. Binds Capslock to Esc and inverts scroll
View MacBookInput.ahk
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#MaxHotKeysPerInterval 500
Capslock::Esc
WheelUp::
Send {WheelDown}
View Focus Start.txt
#
# start — this script runs when a Focus session starts
#
osascript -e 'quit app "Discord"'
osascript -e 'quit app "Spark"'
@skibitsky
skibitsky / Generic Singleton class.cs
Last active Aug 4, 2019
The class must have no public constructors to avoid singleton instance reassignment from outside. Reference: https://stackoverflow.com/a/46259014
View Generic Singleton class.cs
public abstract class Singleton<T> where T : Singleton<T> {
private const string ErrorMessage = " must have a parameterless constructor and all constructors have to be NonPublic.";
private static T _instance = null;
public static T Instance => _instance ?? (_instance = Create());
protected Singleton() {
// Check for public constructors
var pconstr = typeof(T).GetConstructors(BindingFlags.Public | BindingFlags.Instance);
// Tell programmer to fix his stuff
if (pconstr.Any())
View Component system.cs
using System;
using System.Collections.Generic;
using System.Linq;
namespace com.skibitsky.components
{
// Component label interface
public interface IComponent
{
View gist:262f01a068d9447b0157cd15849731c8
on alfred_script(q)
write_to_file(q, "/Users/gleb/.hyper_plugins/hyperalfred.txt", false)
tell application "Hyper" to activate
end alfred_script
on write_to_file(this_data, target_file, append_data)
try
tell application "System Events" to exists file target_file
if not the result then do shell script "> " & quoted form of target_file
set the open_target_file to open for access target_file with write permission