Skip to content

Instantly share code, notes, and snippets.

View unitycoder's full-sized avatar
‏‏‎

mika unitycoder

‏‏‎
View GitHub Profile
@unitycoder
unitycoder / VectorRangeAttribute.cs
Created April 12, 2022 10:45 — forked from DGoodayle/VectorRangeAttribute.cs
Limit a Vector2 within a certain range like a boss.
using UnityEngine;
using UnityEditor;
/*
Vector Range Attribute by Just a Pixel (Danny Goodayle @DGoodayle) - http://www.justapixel.co.uk
Copyright (c) 2015
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 without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
using System.Reflection;
using UnityEditor.ShaderGraph;
using UnityEngine;
[Title("Custom", "Image", "Sobel Edge Detection")]
public class SobelNode : CodeFunctionNode
{
public SobelNode()
{
name = "Sobel Edge Detection";
@unitycoder
unitycoder / opt_fsr.fxh
Created June 15, 2022 05:25 — forked from atyuwen/opt_fsr.fxh
An optimized AMD FSR implementation for Mobiles
//==============================================================================================================================
// An optimized AMD FSR's EASU implementation for Mobiles
// Based on https://github.com/GPUOpen-Effects/FidelityFX-FSR/blob/master/ffx-fsr/ffx_fsr1.h
// Details can be found: https://atyuwen.github.io/posts/optimizing-fsr/
// Distributed under the MIT License. Copyright (c) 2021 atyuwen.
// -- FsrEasuSampleH should be implemented by calling shader, like following:
// AH3 FsrEasuSampleH(AF2 p) { return MyTex.SampleLevel(LinearSampler, p, 0).xyz; }
//==============================================================================================================================
void FsrEasuL(
out AH3 pix,
@unitycoder
unitycoder / Readme.txt
Created June 20, 2022 19:49 — forked from jcward/Readme.txt
Generating iOS P12 / certs without Mac OSX Keychain (on linux, windows, etc)
1) Generate a private key and certificate signing request:
openssl genrsa -out ios_distribution.key 2048
openssl req -new -key ios_distribution.key -out ios_distribution.csr -subj '/emailAddress=me@example.com, CN=Example, C=US'
2) Upload CSR to apple at: https://developer.apple.com/account/ios/certificate/create
- choose Production -> App Store and Ad Hoc
3) Download the resulting ios_distribution.cer, and convert it to .pem format:
@unitycoder
unitycoder / Platform_AndroidTV.cs
Created July 17, 2022 08:06 — forked from ChrisNZL/Platform_AndroidTV.cs
Detects Android TV using Unity.
using UnityEngine;
// DERIVED FROM https://stewmcc.com/post/check-for-android-tv-in-unity/
public class Platform_AndroidTV : MonoBehaviour {
#if UNITY_ANDROID
sbyte isAndroidTV = -1; // -1 == not checked yet; 0 == false; 1 == true
@unitycoder
unitycoder / get_exe_version.c
Created July 28, 2022 21:13 — forked from djha-skin/get_exe_version.c
Get version from EXE file on linux
/* Distributed under the CC-wiki license.
* user contributions licensed under cc by-sa 3.0 with attribution required: https://creativecommons.org/licenses/by-sa/3.0/
* Originally taken from the answer by @rodrigo, found here: http://stackoverflow.com/a/12486703/850326
*/
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <string.h>
#include <stdint.h>
#include <sys/stat.h>
@unitycoder
unitycoder / ffmpeg.md
Created August 10, 2022 06:36 — forked from whizkydee/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

@unitycoder
unitycoder / ffmpeg-commands.sh
Created August 11, 2022 19:24 — forked from 44213/ffmpeg-commands.sh
ffmpeg commands.
# To extract the sound from a video and save it as MP3:
ffmpeg -i <video.mp4> -vn <sound>.mp3
# To convert frames from a video or GIF into individual numbered images:
ffmpeg -i <video.mpg|video.gif> <frame_%d.png>
# To combine numbered images (frame_1.jpg, frame_2.jpg, etc) into a video or GIF:
ffmpeg -i <frame_%d.jpg> -f image2 <video.mpg|video.gif>
# To quickly extract a single frame from a video at time mm:ss and save it as a 128x128 resolution image:
@unitycoder
unitycoder / VoronoiNoise.shader
Created August 16, 2022 20:52 — forked from josephbk117/VoronoiNoise.shader
Voronoi shader in unity
/*Please do support www.bitshiftprogrammer.com by joining the facebook page : fb.com/BitshiftProgrammer
Legal Stuff:
This code is free to use no restrictions but attribution would be appreciated.
Any damage caused either partly or completly due to usage of this stuff is not my responsibility*/
Shader "BitShiftProductions/VoronoiMagic2"
{
Properties
{
}
@unitycoder
unitycoder / GazeRays.cs
Created August 17, 2022 10:06 — forked from qxxxb/GazeRays.cs
Render gaze rays for each eye on the HTC Vive Pro Eye.
using System.Runtime.InteropServices;
using UnityEngine;
using ViveSR.anipal.Eye;
public class GazeRays : MonoBehaviour
{
private static EyeData eyeData = new EyeData();
private bool eye_callback_registered = false;
// Render gaze rays.