Skip to content

Instantly share code, notes, and snippets.

View ikriz's full-sized avatar
👨‍💻
Coding Magic

Kristen ikriz

👨‍💻
Coding Magic
View GitHub Profile
@ikriz
ikriz / gist:8952257
Last active August 29, 2015 13:56
Method to Split YUV Planes
void SplitYUVPlanes(int width, int height, unsigned char *data, int size, unsigned char *yuvInput[3])
{
// live input *data is YUV444 Packed
// Conversion from 444 Packed -> 444 Planar
int index = 0;
int srcStride = size;
// need to flip image from bottom-up to top-down
int revheight = height - 1;
@ikriz
ikriz / PostBuildTrigger.cs
Created February 21, 2014 21:56
Example PostProcessBuild Script referenced at http://www.ikriz.nl/2012/06/18/unity-post-process-mayhem/
using System.IO;
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
public static class PostBuildTrigger
{
private static DirectoryInfo targetdir;
private static string buildname;
private static string buildDataDir;
Shader "Diffuse Lightmap" {
Properties {
_MainTex ("Texture 1", 2D) = "white" {}
}
SubShader {
Tags { "RenderType" = "Opaque" }
Pass {
@ikriz
ikriz / EnableMacros.cs
Last active August 29, 2015 14:27
Unity 4.x Editor Macro's
using UnityEditor;
using UnityEditorInternal;
public class EnableMacros : Editor {
[MenuItem ("Window/Macros")]
static void Init () {
MacroWindow win = (MacroWindow)EditorWindow.CreateInstance<MacroWindow>();
win.Show();
}
}
@ikriz
ikriz / MyStateMachine.cs
Created October 24, 2011 09:36 — forked from AngryAnt/MyStateMachine.cs
A simple state machine using a dictionary of delegates indexed by an enum.
using UnityEngine;
using System.Collections.Generic;
public class MyStateMachine : MonoBehaviour
{
public delegate void StateHandlerDelegate ();
public enum MyStateType
@ikriz
ikriz / EnumFlagAttribute.cs
Last active February 24, 2017 10:27 — forked from ChemiKhazi/EnumFlagAttribute.cs
Unity3d property drawer for automatically making enums flags into mask fields in the inspector.
using UnityEngine;
public class EnumFlagAttribute : PropertyAttribute
{
public string enumName;
public EnumFlagAttribute() {}
public EnumFlagAttribute(string name)
{
@ikriz
ikriz / keybase.md
Created June 30, 2017 14:47
Keybase Verification

Keybase proof

I hereby claim:

  • I am ikriz on github.
  • I am ikriz (https://keybase.io/ikriz) on keybase.
  • I have a public key ASD-KA1MidhC1bkpW8qeINNLO8wPLsdW2gBfLcVAvOz80Qo

To claim this, I am signing this object:

# NMEA to GPX converter
# Peter Pearson
# version 0.11
import csv
import sys
import time
from time import strftime
def convert_dms_to_dec(value, dir):
@ikriz
ikriz / Webcam.cs
Last active January 24, 2019 15:48
Webcam Script to display Webcam Textures [http://www.ikriz.nl/2011/12/23/unity-video-remake/]
using UnityEngine;
public class Webcam : MonoBehaviour
{
public MeshRenderer[] UseWebcamTexture;
private WebCamTexture webcamTexture;
void Start()
{
cvlc /home/ullaakut/Downloads/dummy.jpg -I dummy \
--sout-keep --no-drop-late-frames --no-skip-frames \
--image-duration 9999 \
--sout="#transcode{vcodec=h264,fps=15,venc=x264{preset=ultrafast,tune=zerolatency,keyint=30,bframes=0,ref=1,level=30,profile=baseline,hrd=cbr,crf=20,ratetol=1.0,vbv-maxrate=1200,vbv-bufsize=1200,lookahead=0}}:rtp{sdp=rtsp://:8554/live.sdp}" \
--sout-all