Skip to content

Instantly share code, notes, and snippets.

View robert-wallis's full-sized avatar

Robert Wallis robert-wallis

View GitHub Profile
@robert-wallis
robert-wallis / Export Items.py
Created March 4, 2024 22:28
A Blender 4.0 script to export collections into the ../items folder as png images.
# Renders each collection with Environment to the ./items/ folder
import bpy
import os
base_dir = os.path.dirname(bpy.data.filepath)
items_dir = os.path.join(base_dir, '../', 'items')
if not items_dir:
@robert-wallis
robert-wallis / weeks-in-life.html
Created December 15, 2023 12:39
Shows how long life is
<!DOCTYPE html>
<html>
<head>
<title>Weeks in Life</title>
<meta charset="utf-8" />
<style>
* {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
@media print {

Keybase proof

I hereby claim:

  • I am robert-wallis on github.
  • I am robertwallis (https://keybase.io/robertwallis) on keybase.
  • I have a public key ASDlDbnv5y_2y_eRucUtpczkx6ap8ww2elboZhM1Tkz5vgo

To claim this, I am signing this object:

@robert-wallis
robert-wallis / _.local_share_applications_mirror-1080p-mplayer.desktop
Last active September 13, 2020 01:01
Raspberry PI 4; 4" 480x800 viewfinder; Webcam mirrored on HDMI-2
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Name[en_US]=Mirror Webcam 1080p
Type=Application
Exec=/home/pi/mirror-1080p-mplayer.sh
Categories=AudioVideo;Player
@robert-wallis
robert-wallis / Loop.cpp
Created August 27, 2018 02:04
What's faster `i < list.size()` or `i < size` where size is precomputed?
// My Results: VS 2017, Debug x86 Start-Without-Debugging, i7-4790K 4.0GHz 32.0GB RAM
//
// FunctionCondition 1 = 1783293664
// 369820712 ns
// VariableCondition 1 = 1783293664
// 229243798 ns
// FunctionCondition 2 = 1783293664
// 368293487 ns
// VariableCondition 2 = 1783293664
// 226769355 ns
@robert-wallis
robert-wallis / make_release.sh
Last active April 26, 2018 19:42
Publish git tag with build folder gzipped to github releases from the command line.
#!/bin/bash
# Copyright (C) 2018, Robert A. Wallis, All Rights Reserved
#
# make_release.sh expects a `git tag v1.2.3` style tag to have been created for the version `1.2.3` stored in buildnumber.txt
# It then creates a release out of the commit notes from the previous version's tag to the current version.
# And uploads the contents of the build/ folder as v1.2.3.tgz as an asset.
set -e
GITHUB_USER="robert-wallis"
GITHUB_REPO="yourRepoHere"
@robert-wallis
robert-wallis / NetUi.cs
Last active December 29, 2017 04:55
"Lower-Level" UNet example refactored into UI and Networking classes. https://docs.unity3d.com/Manual/UnityMultiplayerIntegratingLowLevel.html
// Copyright (C) 2017 Robert A. Wallis, All Rights Reserved
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking.Match;
using UnityEngine.UI;
namespace Network {
public class NetUi : MonoBehaviour {
[SerializeField] public Button ButtonCreateRoom;
@robert-wallis
robert-wallis / 8to8.c
Last active August 29, 2015 14:21
8^8 matcher
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#define EIGHTTOEIGHT 0x00FFFFFF
int main(int argc, char** argv)
{
srand(time(NULL));
int match = rand() & EIGHTTOEIGHT;
@robert-wallis
robert-wallis / capture.cpp
Created March 1, 2013 08:43
Capture the raw screen pixels in OSX. Then saves to a file for debugging.
void captureScreen()
{
CGImageRef image_ref = CGDisplayCreateImage(CGMainDisplayID());
CGDataProviderRef provider = CGImageGetDataProvider(image_ref);
CFDataRef dataref = CGDataProviderCopyData(provider);
size_t width, height;
width = CGImageGetWidth(image_ref);
height = CGImageGetHeight(image_ref);
size_t bpp = CGImageGetBitsPerPixel(image_ref) / 8;
uint8 *pixels = malloc(width * height * bpp);
@robert-wallis
robert-wallis / Makefile
Created June 26, 2012 23:55
Static Jade Template Builder
JADE_C="../node/node_modules/jade/bin/jade"
template_OUT=../../static
template_JADE=*.jade */*.jade
template_HTML=$(foreach source_file, $(template_JADE), ${template_OUT}/${source_file:.jade=.html})
.PHONY: all
all: $(template_HTML)
$(template_OUT)/%.html: %.jade