Skip to content

Instantly share code, notes, and snippets.

View AndreasH96's full-sized avatar
🧙‍♂️

Andreas Häggström AndreasH96

🧙‍♂️
View GitHub Profile
@AndreasH96
AndreasH96 / mozilla_hubs_snap_shared_screen.js
Last active February 22, 2021 01:55
This code is based on a gist made by Utophia, https://gist.github.com/Utopiah/f2b11a8026030b726ecc8c8c9430a9b4 . It's made for being able to snap videos onto objects that are within object-groups. The code is made to be added into the file "floaty-objects.js" within the hubs client code base (2020-06-25).
snap(toSnap, snapOn) {
// Align rotation
toSnap.el.object3D.setRotationFromQuaternion(snapOn.object3D.getWorldQuaternion());
// Align position
toSnap.el.object3D.position.copy(snapOn.object3D.getWorldPosition());
// Set to same scale
toSnap.el.object3D.scale.copy(snapOn.object3D.getWorldScale());
// Move slightly to avoid texture tearing
@AndreasH96
AndreasH96 / floaty-object.js
Last active August 18, 2020 14:22
Modified version of hubs\src\components\floaty-object.js with the added ability to snap video objects and shared screens to objects. Usage: 1.replace the floaty-object.js file. 2. Create an image within Spoke named "snapobject" (see line 39). Now when you share a screen it should snap onto the image when released closed enough.
/* global AFRAME */
const COLLISION_LAYERS = require("../constants").COLLISION_LAYERS;
AFRAME.registerComponent("floaty-object", {
schema: {
// Make the object locked/kinematic upon load
autoLockOnLoad: { default: false },
// Make the object kinematic immediately upon release
autoLockOnRelease: { default: false },
@AndreasH96
AndreasH96 / sticky-object.js
Last active August 17, 2020 13:23
This code is based on a gist made by Utophia, https://gist.github.com/Utopiah/f2b11a8026030b726ecc8c8c9430a9b4 . It's made for being able to snap videos onto other objects.
/* global AFRAME */
const COLLISION_LAYERS = require("../constants").COLLISION_LAYERS;
AFRAME.registerComponent("sticky-object", {
schema: { resetScaleWhenGrabbed: { default: true } },
init() {
this.currentSnapTarget = null;
const physicsSystem = this.el.sceneEl.systems["hubs-systems"].physicsSystem;
@AndreasH96
AndreasH96 / day11.jl
Last active January 12, 2021 15:15
AoC day11
using Printf
using Test
using DSP
using ImageFiltering
testData = readlines("testinput.txt")
realData = readlines("input.txt")
# Translates L => 1, . => 0 , # => -1
function parseData(data)
replacement = Dict('L' => 1, '.'=>0,'#'=>-1)
@AndreasH96
AndreasH96 / tensorflow2_9_cuda_quickfix.py
Created June 1, 2022 12:56
Bypasses the cudart64_110.dll not found error when importing tensorflow with cuda 11.2
import os
os.add_dll_directory("C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.2/bin")
import tensorflow