Skip to content

Instantly share code, notes, and snippets.

View pushmatrix's full-sized avatar

Daniel Beauchamp pushmatrix

View GitHub Profile
require 'http'
class OpenAI
URI = "https://api.openai.com/v1"
def initialize(api_key:)
@api_key = api_key
end
def completion(prompt:, max_tokens: 400, temperature: 1.0, stop: "<|endoftext|>")
response = HTTP.headers(headers).post(
float scale = Mathf.Min((targetWidth / screenWidth), 1);
platformYPosition = Mathf.Sin(realtime.room.time);
@pushmatrix
pushmatrix / helmet.gltf
Last active July 17, 2020 17:07
Melded helmet
{
"accessors": [
{
"bufferView": 0,
"byteOffset": 0,
"count": 70074,
"componentType": 5126,
"type": "VEC3",
"min": [
-1.151152491569519,
@pushmatrix
pushmatrix / chair.gltf
Created July 17, 2020 15:35
Melded chair
{
"accessors": [
{
"bufferView": 0,
"byteOffset": 0,
"count": 10043,
"componentType": 5126,
"type": "VEC3",
"min": [
-16.300094604492188,
@pushmatrix
pushmatrix / shoes.gltf
Created July 17, 2020 15:31
Melded shoes
{
"accessors": [
{
"bufferView": 0,
"byteOffset": 0,
"count": 13540,
"componentType": 5126,
"type": "VEC3",
"min": [
-0.999970018863678,
@pushmatrix
pushmatrix / usdz.rb
Last active June 10, 2020 16:57
Create a usdz box in ruby land
USDZ_TEMPLATE = File.open('cube.usdz', 'rb').read
def generate_usdz(length, width, height)
usdz = USDZ_TEMPLATE.dup
# This is the block of bytes in the buffer that represent the vertex positions
# They are stored as 32-bit floats
buffer = usdz[1168,624].unpack("F*")
buffer = resize_box_buffer(buffer, length, width, height)
@pushmatrix
pushmatrix / create-usdz.js
Last active June 10, 2020 13:25
Create a cube.usdz of any size in the browser!
function createUSDZ(length, width, height) {
// Bytes corresponding to a 1m x 1m x 1m cube
const bytes = [80,75,3,4,10,0,0,0,0,0,121,71,202,80,241,6,140,202,131,11,0,0,131,11,0,0,10,0,24,0,99,117,98,101,50,46,117,115,100,99,134,25,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,80,88,82,45,85,83,68,67,0,7,0,0,0,0,0,0,187,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,4,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,1,0,0,0,0,0,10,64,1,0,0,0,0,0,0,0,2,0,0,0,8,0,0,0,0,0,0,0,3,0,0,0,0,0,10,64,2,0,0,0,0,0,0,0,17,0,0,0,18,0,0,0,3,0,0,0,0,0,0,0,20,0,0,0,21,0,0,0,22,0,0,0,3,0,0,0,0,0,0,0,24,0,0,0,25,0,0,0,26,0,0,0,10,0,0,0,0,0,0,0,28,0,0,0,29,0,0,0,30,0,0,0,31,0,0,0,32,0,0,0,33,0,0,0,34,0,0,0,35,0,0,0,36,0,0,0,25,0,0,0,1,0,0,0,0,0,0,0,37,0,0,0,1,0,0,0,0,0,0,0,38,0,0,0,1,0,0,0,0,0,0,0,39,0,0,0,4,0,0,0,0,0,0,0,41,0,0,0,39,0,0,0,42,0,0,0,43,0,0,0,12,0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,3,
@pushmatrix
pushmatrix / create-usds.js
Last active June 10, 2020 13:24
Creating a usdz cube of any size
let fs = require('fs');
function createUSDZ(length, width, height) {
// Offset where the x, y, z scale properties are set
const byteOffset = 1344;
fs.readFile('cube.usdz', null, function (err, data) {
let view = new DataView(data.buffer);
@pushmatrix
pushmatrix / instructions.md
Created February 21, 2020 01:35
Embedding Unity Packages

Embedding packages

Let's say you want to edit a package that you download with the package manager. You can actually make it so you have a local copy of the package that overrides what's in your package cache.

  1. Put this in your Unity project: https://gist.github.com/liortal53/111ee2a659b0d59c80faab0f5d457531
  2. Right click on the package you want, and press Embed Package
  3. You now have a copy of the package in your Packages dir
  4. If you delete that package folder, Unity will automatically switch back to using the package manager version. All references to scripts will stay intact.