Skip to content

Instantly share code, notes, and snippets.

View tomires's full-sized avatar

Tomáš Havlík tomires

View GitHub Profile
@haosizheng
haosizheng / ImageSequenceRecorderWithTransparentBackground.cs
Last active April 14, 2024 14:10 — forked from bitbutter/TransparentBackgroundScreenshotRecorder.cs
Save image sequence in Unity with transparent background.
using UnityEngine;
using System.Collections;
using System.IO;
using UnityEngine.Rendering.Universal;
/*
Usage:
1. Attach this script to your chosen camera's game object.
2. Set that camera's Clear Flags field to Solid Color.
3. Use the inspector to set frameRate and framesToCapture
@DanMillerDev
DanMillerDev / MobileOcclusion.shader
Created July 30, 2019 05:52
Occlusion shader for Unity. Can be used for mobile AR Occlusion
Shader "Custom/MobileOcclusion"
{
SubShader {
Pass {
// Render the Occlusion shader before all
// opaque geometry to prime the depth buffer.
Tags { "Queue"="Geometry" }
ZWrite On
ZTest LEqual
@neozero
neozero / main.cpp
Last active November 19, 2023 18:31
OculusHomeless - Use Oculus Dash without Home 2.0
/************************************************************************************
Content : First-person view test application for Oculus Rift
Created : 19th June 2015
Authors : Tom Heath
Copyright : Copyright 2015 Oculus, Inc. All Rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
@ericroy
ericroy / ntp.lua
Last active April 30, 2017 01:32
NTP time check using lua socket
-- Most of this came from the blog article here:
-- https://lettier.github.io/posts/2016-04-26-lets-make-a-ntp-client-in-c.html
-- For reference, the packet structure looks like:
--[[
typedef struct
{
unsigned li : 2; // Only two bits. Leap indicator.
unsigned vn : 3; // Only three bits. Version number of the protocol.
unsigned mode : 3; // Only three bits. Mode. Client will pick mode 3 for client.
@yajra
yajra / axios-401-response-interceptor.js
Last active September 20, 2023 06:24
Axios 401 response interceptor.
// Add a 401 response interceptor
window.axios.interceptors.response.use(function (response) {
return response;
}, function (error) {
if (401 === error.response.status) {
swal({
title: "Session Expired",
text: "Your session has expired. Would you like to be redirected to the login page?",
type: "warning",
showCancelButton: true,
@jschaub30
jschaub30 / gml2json.py
Last active June 1, 2021 02:38
Python script for converting graphml (*gml) files to json
#!/usr/bin/env python
import sys
def gml_sub(blob):
lines = []
for line in blob.split('\n'):
line = line.strip()
lines.append(line)
@bitbutter
bitbutter / TransparentBackgroundScreenshotRecorder.cs
Last active May 19, 2024 21:59
Rendering screenshots from Unity3d with transparent backgrounds
using UnityEngine;
using System.Collections;
using System.IO;
/*
Usage:
1. Attach this script to your chosen camera's game object.
2. Set that camera's Clear Flags field to Solid Color.
3. Use the inspector to set frameRate and framesToCapture
@badsyntax
badsyntax / email_validation.js
Created November 29, 2010 10:32
rfc822 email validation in JS
// See http://rosskendall.com/blog/web/javascript-function-to-check-an-email-address-conforms-to-rfc822
function isEmail(email){
return /^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/.test( email );
}