Skip to content

Instantly share code, notes, and snippets.

View AngryAnt's full-sized avatar

Emil "AngryAnt" Johansen AngryAnt

View GitHub Profile
@AngryAnt
AngryAnt / MissingHassModule.sh
Last active July 31, 2023 17:51
List the home assistant modules reported missing by the nixos home assistant service since it was last started.
#!/usr/bin/env bash
set -euo pipefail
serviceName="home-assistant.service"
startTime=$(systemctl show -p ActiveEnterTimestamp "$serviceName")
startTime=$(echo $startTime | awk '{print $2 $3}')
echo "Missing modules reported since $serviceName start at $startTime:"
@AngryAnt
AngryAnt / user-callback
Created December 11, 2019 08:20
User callback script for BackInTime handling mount & unmount of encrypted backup target and using the modify date of a file to communicate last snapshot date.
#!/bin/bash
# Copyright (c) 2012-2015 Germar Reitze
# Mount/unmount implementation 2019 Emil "AngryAnt" Johansen
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
//
// main.swift
// Jerboa
//
// Created by Emil Johansen on 19/01/2019.
// Copyright © 2019 AngryAnt. All rights reserved.
//
// https://en.wikipedia.org/wiki/Jerboa
//
@AngryAnt
AngryAnt / Drawer.cs
Last active October 6, 2021 20:55
Attempting to override the default UnityEvent drawer.
using UnityEngine;
using UnityEditor;
using UnityEditorInternal;
using UnityEngine.Events;
using System.Reflection;
namespace Test
{
[CustomPropertyDrawer (typeof (UnityEventBase), true)]
using UnityEngine;
public class CoreCharacterInstance : MonoBehaviour
{
[SerializeField] CoreCharacter m_CoreCharacter;
[SerializeField] Character m_Character;
void Reset ()

Keybase proof

I hereby claim:

  • I am angryant on github.
  • I am angryant (https://keybase.io/angryant) on keybase.
  • I have a public key ASD8ySmPVOXxJ6-08vcEIoK2yFrxwh6eUfa6DgVY6EuKSwo

To claim this, I am signing this object:

@AngryAnt
AngryAnt / MoveComponentContext.cs
Last active July 5, 2017 05:44
Adds "Move to Top" and "Move to Bottom" items to the inspector context menu of components.
using UnityEngine;
using UnityEditor;
public class MoveComponentContext
{
enum Destination
{
Top,
Bottom
@AngryAnt
AngryAnt / BehaveExtensions.cs
Last active August 29, 2015 14:14
Tree.ReflectClassForwards (GameObject) and Tree.SetForwards (int id, IActionClass actionClass). This is now built-in per Behave 2.6.
using UnityEngine;
using Behave.Runtime;
using Library = BLYourLibraryName;
using Tree = Behave.Runtime.Tree;
public interface IActionClass
{
bool OnForward (Tree sender);
BehaveResult Init (Tree sender);
const int
kPreLevelScenes = 2, // Number of scenes before the first level (splash, menu, etc.)
kPostLevelScenes = 0; // Number of scenes after last level (score, credits, whatever)
const string kLevelScorePrefix = "Score for level ";
// ...
void OnLevelBeat ()
{
if (Application.loadedLevel < Application.levelCount - kPostLevelScenes - 1)
//#define DEBUG_THREADING
using UnityEngine;
using System.Collections;
using System.Threading;
using System.Reflection;
public delegate IEnumerator MonitorCoroutine<T> (CoroutineData<T> data);