Skip to content

Instantly share code, notes, and snippets.

View paulhayes's full-sized avatar

Paul Hayes paulhayes

View GitHub Profile
@JChristensen
JChristensen / AVR Sleep
Last active March 31, 2024 18:42
AVR microcontroller sleep demonstrations
Simple demonstrations of putting AVR microcontrollers to sleep in power-down mode,
which results in minimum current. Coded with Arduino IDE version 1.0.4 (and with
the Arduino-Tiny core for the ATtiny MCUs, http://code.google.com/p/arduino-tiny/)
For ATmega328P, ~0.1µA.
For ATtinyX5 revisions that implement software BOD disable, ~0.1µA,
for ATtinyX5 revisions that don't, ~20µA.
@Farfarer
Farfarer / CubemapToEquirectangularWizard.cs
Last active July 2, 2024 06:54
Create dynamic equirectangular maps for Unity. These have the benefit that, as they're flat images, you can sample lower mips to get blurry reflections. The straight cubemap version (detailed here: http://www.farfarer.com/blog/2011/07/25/dynamic-ambient-lighting-in-unity/ ) will give you hard seams when you sample mips from the cubemap. Although…
// Wizard to convert a cubemap to an equirectangular cubemap.
// Put this into an /Editor folder
// Run it from Tools > Cubemap to Equirectangular Map
using UnityEditor;
using UnityEngine;
using System.IO;
class CubemapToEquirectangularWizard : ScriptableWizard {
@frarees
frarees / MinMaxSliderAttribute.cs
Last active April 4, 2024 12:13
MinMaxSlider for Unity
// https://frarees.github.io/default-gist-license
using System;
using UnityEngine;
[AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
public class MinMaxSliderAttribute : PropertyAttribute
{
public float Min { get; set; }
public float Max { get; set; }
@andykorth
andykorth / gist:bf8e4509402c1f090c1c
Created April 30, 2014 18:48
Live drawing of FFT data in Unity3D
public AudioSource audioSauce;
public string CurrentAudioInput = "none";
int deviceNum = 0;
void Start()
{
string[] inputDevices = new string[Microphone.devices.Length];
deviceNum = 0;
@revett
revett / git_branch_naming.md
Last active December 22, 2023 17:12
Git Branch Naming Conventions

Syntax

<author>/<type>/<ticket>/<title>

Example

revett/feature/24101/skeleton-service-for-email-sender
@digitalshadow
digitalshadow / OpenSimplexNoise.cs
Last active June 25, 2024 07:41
OpenSimplex Noise Refactored for C#
/* OpenSimplex Noise in C#
* Ported from https://gist.github.com/KdotJPG/b1270127455a94ac5d19
* and heavily refactored to improve performance. */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
namespace NoiseTest
@naojitaniguchi
naojitaniguchi / VideoPicker.cs
Last active September 15, 2020 10:17
Video Picker for Unity iOS native plugin call sample, Using UIImagePickerController
using UnityEngine;
using System.Collections;
using System.Runtime.InteropServices;
public class VideoPicker : MonoBehaviour {
public Texture2D shareButtonImage; // Use this for initialization
[DllImport("__Internal")]
private static extern void OpenVideoPicker(string game_object_name, string function_name);
@cjacobwade
cjacobwade / CheapToggle.shader
Created August 18, 2015 21:22
#unity3d example showing how to add a checkbox to a shader property and use it to flip between colors.
Shader "Custom/CheapToggle"
{
Properties
{
_ColorA ( "Color A", Color ) = ( 1, 1, 1, 1 )
_ColorB ( "Color B", Color ) = ( 1, 1, 1, 1 )
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
@etes
etes / pi_mount_usb.md
Last active June 15, 2024 13:39
How to setup mount / auto-mount USB Hard Drive on Raspberry Pi

How to setup mount / auto-mount USB Hard Drive on Raspberry Pi

Follow the simple steps in the order mentioned below to have your USB drive mounted on your Raspberry Pi every time you boot it.

These steps are required especially if your are setting up a Samba share, or a 24x7 torrent downloader, or alike where your Raspberry Pi must have your external storage already mounted and ready for access by the services / daemons.

Step 0. Plug in your USB HDD / Drive to Raspberry Pi If you are using a NTFS formatted drive, install the following

@DGoodayle
DGoodayle / QuadTreeTest.cs
Last active June 9, 2023 10:59
Quadtree in Unity
using UnityEngine;
using System.Collections;
public class QuadTreeTest : MonoBehaviour {
public class TestObject : IQuadTreeObject{
private Vector3 m_vPosition;
public TestObject(Vector3 position){
m_vPosition = position;
}
public Vector2 GetPosition(){