Skip to content

Instantly share code, notes, and snippets.

View skibitsky's full-sized avatar

Gleb Skibitsky skibitsky

View GitHub Profile
@skibitsky
skibitsky / sideload.sh
Created May 24, 2023 03:49
This script sideloads an APK and its corresponding OBB file to an Android device.
#!/bin/sh
# This script installs an APK and its corresponding OBB file to an Android device.
# It requires the path to the directory containing the APK and OBB file(s) as an input parameter.
# The script will find the APK and the OBB file with the highest version number in the directory,
# then install the APK and upload the OBB file to the appropriate location on the device.
# It also handles uninstalling the existing APK, creating the OBB directory if necessary,
# and removing any existing OBB files for the APK.
#
# The script relies on Android Debug Bridge (adb) to communicate with the device.
@skibitsky
skibitsky / BiasDiffuse.shader
Created February 23, 2021 11:52
Simple diffuse surface shader with mip map bias support
Shader "Futuclass/BiasDiffuse"
{
Properties
{
_MainTex ("Base (RGB)", 2D) = "white" {}
_MainTexBias ("Mip Bias", float) = -0.5
}
SubShader
{
Tags
@skibitsky
skibitsky / Billboard.shader
Last active February 19, 2021 08:11
Best billboard shader. Transparency, rotation, scale, optional "render on top".
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 October 24, 2021 08:31
Stereo Single Pass Screen Fading Shader
Shader "Custom/ScreenFader"
{
Properties
{
_MainTex("Texture", 2D) = "white" {}
_FadeColor ("Color", Color) = (0,0,0,0)
_Intensity ("Intensity", float) = 0
}
SubShader
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
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 October 31, 2019 18:37
MacBook Input macro for AutoHotkey. Binds Capslock to Esc and inverts scroll
#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}
@skibitsky
skibitsky / Focus Start.txt
Last active August 20, 2019 08:11
Start script for Focus app. https://heyfocus.com/
#
# 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 August 4, 2019 17:43
The class must have no public constructors to avoid singleton instance reassignment from outside. Reference: https://stackoverflow.com/a/46259014
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())
using System;
using System.Collections.Generic;
using System.Linq;
namespace com.skibitsky.components
{
// Component label interface
public interface IComponent
{