Skip to content

Instantly share code, notes, and snippets.

@nbogie
nbogie / MouseLookScript.cs
Created November 16, 2021 15:22
MouseLookScript - Unity - Old input system
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MouseLookScript : MonoBehaviour
{
public float lookSensitivity = 10f;
private float leftRightAngle = 0;
private float upDownAngle = 0;
@nbogie
nbogie / Unity.gitignore
Created November 16, 2021 00:21
Unity .gitignore
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
# Neill modified to ignore .log files.
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
[
{
"placeName": "St. Thomas",
"location": "British Virgin Islands, Caribbean",
"description": "Beautiful island with great people, be careful of the lizards",
"image": {
"src": "https://images.unsplash.com/photo-1557598003-15d7d605adaa?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=2070&q=80",
"altText": "Virgin islands beach"
}
},
@nbogie
nbogie / check_puppet_syntax.sh
Created June 17, 2011 15:48
script to syntax-check puppet .pp and .erb files
#!/bin/bash
#Script to test puppet files have valid syntax.
#Intended for use with hudson/jenkins.
set -e
set -u
fail=0
#TODO: Run these in parallel - we have 4 cores.
#TODO: Control the environment (through the config dir?).
@nbogie
nbogie / midipipe-amazon-music-control.applescript
Created February 16, 2017 09:32
simple applescript for midipipe, to allow MIDI control of amazon music player in Chrome
on isMidiButtonPressed(msg, bNumber)
return ((item 1 of msg = 191) and (item 2 of msg = bNumber) and (item 3 of msg > 0))
end isMidiButtonPressed
on jsClick(theTab, sel)
tell application "Google Chrome"
execute theTab javascript ("document.querySelector('" & sel & "').click()")
end tell
end jsClick
@nbogie
nbogie / DumpObjectToConsoleForThree.js
Created November 9, 2020 19:39
utility functions to report structure of scene / sub-scene to console, for three.js (at least for gltf-loaded-models). by@greggman https://threejsfundamentals.org/threejs/lessons/threejs-load-gltf.html
import * as THREE from 'https://unpkg.com/three@0.122.0/build/three.module.js';
function dumpObjectToTextLines(obj, lines = [], isLast = true, prefix = '') {
if (!obj || !obj.children) {
return lines;
}
const localPrefix = isLast ? '└─' : '├─';
lines.push(`${prefix}${prefix ? localPrefix : ''}${obj.name || '*no-name*'} [${obj.type}]`);
const newPrefix = prefix + (isLast ? ' ' : '│ ');
const lastNdx = obj.children.length - 1;
@nbogie
nbogie / recipe.json
Last active November 3, 2020 17:15
cyf - example recipe for recipe API
{
"title": "Adana",
"ingredients": [
"1 kg ground lamb",
"Kosher salt",
"4 teaspoons ground cumin, divided",
"4 tablespoons ground sumac, divided",
"4 tablespoon ground Urfa pepper flakes, divided",
"4 tablespoons ice-cold water"
],

Getting create-react-app working on Ubuntu (19.04)

problems and solutions

Main success conditions to be met:

We will be done if...

  • npx create-react-app is runs and completes successfully
  • student can run the react app created by the above
@nbogie
nbogie / SimpleAesonJsonExample.hs
Created May 22, 2011 16:19
Simplest Aeson json parsing and generation example
{-# LANGUAGE OverloadedStrings #-}
-- This is a very simple example of parsing and generating json with Aeson,
-- by a haskell newbie and intended for newbies.
--
-- This almost certainly contains a number of bad practices. It works for
-- me and hopefully will get you started.
--
-- I couldn't find a stand-alone example of Aeson usage and found it tricky to
-- get going. For example, if you don't realize to enable the language extension
@nbogie
nbogie / stacked-layers-shader.shadertoy
Last active August 29, 2020 00:13
Stacked layers of-noise for shadertoy: https://www.shadertoy.com/view/3tsBDX
// Trying to build stacked crosssectional plates of animated 3d noise, to mimic this work:
//https://jacobjoaquin.tumblr.com/post/188120374046/jacobjoaquin-volumetric-noise-20190225
//
// Using the noise algorithm from this shader by iq: https://www.shadertoy.com/view/4sfGzS
// then making it have octaves.
//
// TODO: Make the plates square and isometric.
// TODO: Fix the noise so that builds in from both up as well as down.
// TODO: Correctly just overlay the colours of each upper disc on the lower discs, if the upper pixel is not transparent. Need to model alpha.
// TODO: don't calculate a noise value that is going to be thrown away!