Skip to content

Instantly share code, notes, and snippets.

@wallabyway
wallabyway / lambda_function.py
Last active July 12, 2024 00:15
SSA Token generator on Lambda (minimal)
# https://gist.github.com/wallabyway/3efdaf7ab52368cd019678b027055bd1
import jwt
import time
import requests
import os
def generate_jwt_assertion(kid, private_key, APS_clientID, SSA_oxygenID, scope):
current_time = int(time.time())
claims = {
"iss": APS_clientID,
@wallabyway
wallabyway / simplesearch.js
Created July 10, 2024 20:20 — forked from N8python/simplesearch.js
It's pretty simple to make a half-decent search agent.
import googleIt from 'google-it';
import axios from 'axios';
import cheerio from 'cheerio';
import OpenAI from 'openai';
import readlineSync from 'readline-sync';
const openai = new OpenAI({
baseURL: "http://localhost:1234/v1",
apiKey: 'My API Key'
});
@wallabyway
wallabyway / handler.js
Created April 29, 2024 20:50
Tandem Connect - code block support for ES6, async/await and modules, anti lint
/* jshint esversion: 8 */
'use strict'
const axios = require('axios');
/**
* Handler function that will process the data and return a result.
*
* @param {Object} data - Data to be processed.
* @param {Objcct} logger - Can be used for any logging purposes.
* @param {Function} logger.log - Use to log anything i.e. logger.log(Object | String)
@wallabyway
wallabyway / package.json
Created May 16, 2023 06:12
minimal powerBI visual component with three.js (spinning grid)
{
"name": "visual",
"description": "default_template_value",
"repository": {
"type": "default_template_value",
"url": "default_template_value"
},
"license": "MIT",
"scripts": {
"pbiviz": "pbiviz",
@wallabyway
wallabyway / index.html
Last active December 9, 2022 18:33
multi-model-load with glb example / Live site: http://bl.ocks.org/wallabyway/raw/3f3d8631cf3b0994f002f5779d45ce11/
<head>
<title>Viewer Loading Multi-Model with GLB</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="data:,">
<style>
#panel {
position: fixed; z-index: 2; margin: 10px;
font-family:arial; font-size:1.5em; }
</style>
@wallabyway
wallabyway / convert-glb.mjs
Created June 30, 2022 04:08
convert 3D-Tiles v1 to v1.1 (3D-Tiles-Next) for point clouds
// PURPOSE: convert draco-pnts to glb (ie. 3dTiles v1.0 to v1.1)
// INSTALL: npm install draco3d gltfpack
// RUN:
// > node infolderPNTS outfolderGLB
import fs from 'fs';
import draco3d from 'draco3d';
import gltfpack from 'gltfpack';
const inFolder = process.argv.slice(2)[0] || 'infolder';
@wallabyway
wallabyway / pull-tiles-offline.mjs
Last active June 29, 2022 21:19
handy batch download of 3d-tiles tileset.json from bim360 (using batchPromises for threads)
// PURPOSE: download 3d-tiles files from BIM360, to local drive
// INSTALL: npm install node-fetch
// RUN: add your BIM360 access-token and the base url, then type
// > node pull-tiles-offline.mjs myOutputFolder
import fetch from 'node-fetch';
import fs from 'fs';
import util from 'util';
import stream from 'stream';
@wallabyway
wallabyway / index.html
Created June 16, 2022 23:13
minimal three.js modules (no buildpack)
<header>
<style>
body { font-family: arial; margin: 0; }
.nav {
color: white; background-color: rgba(100, 100, 100, 0.5);
text-align: center; width: 100%; top: 0px;
position: fixed; z-index: 1; margin: 0px;
}
</style>
</header>
@wallabyway
wallabyway / clone-three-mesh.html
Created March 31, 2022 19:33
let mesh = viewer.model.getFragmentList().getVizmesh(fragId).clone();
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="icon" href="data:,">
@wallabyway
wallabyway / unlit-texture.js
Last active March 31, 2022 19:32
solving texture material in forgeViewer, so it is completely unlit (no weird lighting artifacts
function getFlatTexture_FlatMaterial(textureUrl) {
const shader = {
side: THREE.DoubleSide,
depthWrite: false,
depthTest: true,
uniforms: {
map: { value: THREE.ImageUtils.loadTexture(textureUrl), type: 't' }
},
fragmentShader: `
varying vec2 vUv;