Skip to content

Instantly share code, notes, and snippets.

View blewert's full-sized avatar
:electron:
back to electron!

Benjamin Williams blewert

:electron:
back to electron!
View GitHub Profile
@blewert
blewert / README.md
Last active April 18, 2024 17:05
Unity in-scene rect tool editor

rect tool

Unity in-scene rect tool editor

This is a small proof-of-concept project in Unity 2022 to enable the free translation and modification of various axis-aligned rectangles in-scene. The rectangles are oriented on the xz plane. This was made to help a student out with some initial code for a tools development module. The solution uses a single class, Rectangle, which has four points as members. The RectangleEditor editor script performs in-scene tooling via the Handles class to:

  1. Enable free movement of the rectangles via a handle in the centroid of the rectangle.
  2. Enable free, axis-aligned resizing of the rectangles via the four small circles shown in the image above.

This code is licensed under the Unlicense; feel free to copy, modify or whatever.

This file has been truncated, but you can view the full file.
[session]
car = Porsche 911 GT3 RS
class = Road B
track = Bannochbrae
track_variant = Road Circuit
[data]
0.065979 70.2297 -39.7066 5.84384 0.00150648 -1.53196 -0.000349648 0.0001023 0.0208138 -0.707481 0.00123274 -0.199091 -5.38907 -0.028807 3.83475e-05 0.000605562 1 0 1 0.741386 8775.24 0.729717 -1.07374e+08 0.990368 0.990854 0.998327 0.997332 344.927 344.915 344.977 344.988 -2.03882 -2.04214 -2.01899 -2.01899 -0.452479 -0.405347 0.623045 35.1224 1167.48 0
0.132996 70.2922 -39.7051 5.84139 0.00356337 -1.53196 -0.000412736 0.000128803 0.00799681 -1.12016 0.000665879 -0.123741 -6.802 -0.0319154 -0.00016346 0.0010617 1 0 1 0.688014 8820.48 1.14536 -1.07374e+08 0.987139 0.989738 0.957024 0.955022 344.929 344.913 344.937 344.948 -3.22798 -3.22743 -3.28368 -3.28368 -0.452479 -0.405347 0.623045 35.2128 1167.08 0
0.199951 70.3852 -39.7039 5.83775 0.00566705 -1.53194 -0.000489663 0.000402327 -0.000453863 -1.61105 0.00767045 -0.0597562 -8.02342 -0.0307802 -0.000537556 0.00133098 1 0 1 0.635526 8797.24 1.64619 -1.073
const config = require('./cfg/streams.json');
const { spawn } = require('child_process');
var streamProcs = [];
for(let stream of config.streams)
{
let streamProc = spawn("node", ["stream.js", stream.port, stream.url ]);
console.log(`> Started stream ${stream.key} on port ${stream.port}: ${stream.url}`);
t_test_pneg = 0
t_test_pneu = 0
t_test_nneu = 0
ans =
0.4820 0.5271 0.5012
t_test_polarity_pneg = 0.9589
t_test_polarity_pneu = 0
t_test_polarity_nneu = 0
@blewert
blewert / SimpleModularBuildingGenerator.cs
Created January 14, 2021 12:39
A simple modular building generator for Unity.
/**
* @brief A simple modular building generator for Unity.
* @author Benjamin Williams
*/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SimpleModularBuildingGenerator : MonoBehaviour
from math import sqrt;
import random
import string
s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
keyset = ''.join(random.sample(s,len(s)));
cleartext = "wepogkwepokgwep jgwokegpo wkepgo kwepogkwpoekgpowekgpowekgpowekgpokweg wekgpowegpokweg".upper();
cur_hp = 90;
cur_ar = 10;
print("hp: " + str(cur_hp));
print("ar: " + str(cur_ar));
damage = 333.7;
print("\n-" + str(damage));
# armour
%%
%% lincolncsthesis.cls
%% Copyright 2019 Benjamin Williams <bwilliams@lincoln.ac.uk>
%%
%% A LaTeX template for typesetting research degree theses
%% according to the University of Lincoln School of Computer Science
%% thesis guidelines.
%%
%% It is worth noting that the main inspiration (and small snippets of code)
%% for this template was Cameron Gray's bangorcsthesis template.
@blewert
blewert / doggos.jsx
Created February 20, 2020 21:10
A working example of a horizontal ScrollView with some example click events.
import React, { Component } from 'react';
import { StyleSheet, Text, View, Button, ScrollView } from 'react-native';
class DoggoListButton extends Component
{
handlePressButton()
{
//This is called when you press this doggo button
//it just prints out the name of this doggo and its number that was passed :)
alert("hello i am " + this.props.doggo + ", my number is " + this.props.num + " and I am the bestest boyo in the whole wide WORLD");
// Upgrade NOTE: replaced '_World2Object' with 'unity_WorldToObject'
/**
* @author Benjamin Williams <bwilliams@lincoln.ac.uk>
* @file threshold-shader.shader
*/
Shader "blewert/Dist-based Threshold"
{
Properties