Skip to content

Instantly share code, notes, and snippets.

View Nitecon's full-sized avatar
💭
The unicorns don't look realistic enough!

Will Nitecon

💭
The unicorns don't look realistic enough!
View GitHub Profile
@Nitecon
Nitecon / gov
Last active June 29, 2016 15:31
gov provides a way to create vendor experiment setups directly (Requires mac / linux)
#!/bin/bash
GOSRC="$GOPATH/src/"
CURPATH=`pwd`
if [ -z "$GOPATH" ]; then
echo "Need to set GOPATH"
exit 1
fi
if ! [[ $GOPATH == */ ]]; then
@Nitecon
Nitecon / panic.go
Created February 20, 2019 21:20
Table driven golang panic test
package main
func addLevelPool(level int) {
if level > 9{
panic("runtime error: index out of range")
}
}
@Nitecon
Nitecon / motion_activated_scenes.yaml
Last active July 26, 2022 01:47
Motion activated scenes for home assistant
blueprint:
name: Motion activated scenes
description: Activate a day/night scene when motion is detected. Without motion an off scene is triggered.
domain: automation
source_url: https://gist.github.com/Nitecon/77b0485080f63550b38d2bd3e91df904
input:
motion_entity:
name: Motion Sensor
selector:
entity:
# This takes an owner of a repo, the repo name iteself and then looks up latest tag and gets the tarball url downloads the file.
# then extracts it to /tmp/$REPO
OWNER=iMicknl;REPO=ha-nest-protect; curl -o ${REPO}.tar.gz -L $(curl -s https://api.github.com/repos/${OWNER}/${REPO}/releases/latest | grep "tarball_url" | cut -d : -f 2,3 | tr -d \"|tr -d , | awk '{$1=$1};1') && mkdir -p /tmp/${REPO}; tar -xf ${REPO}.tar.gz --strip-components=1 -C /tmp/${REPO}
@Nitecon
Nitecon / sensorActivatedLights.yaml
Last active December 15, 2022 00:22
Use a broader sensor type for motion activated lights
blueprint:
name: Sensor-activated Light
description: Turn on a light when motion is detected.
domain: automation
source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/automation/blueprints/motion_light.yaml
input:
motion_entity:
name: Motion Sensor
selector:
entity:
@Nitecon
Nitecon / Nginx Vhost Example
Created March 31, 2023 17:23
This vhost example is for use with golang text/template and exposes 2 variables to be replaced.
server {
listen 80;
server_name {{.Domain}};
root {{.VHOST_ROOT}};
index index.html index.htm;
location / {
try_files $uri $uri/ /index.html;
}
@Nitecon
Nitecon / NeuralData.cpp
Created January 17, 2024 03:20
Neural Data Subsystem for unreal engine.
#include "NeuralData.h"
#include "NNE.h"
UNeuralData::UNeuralData(): SelectedRuntimeType(ERuntimeType::CPU)
{
}
bool UNeuralData::InitModel(const FString& ModelPath, const FString& RuntimeType)
{