Skip to content

Instantly share code, notes, and snippets.

View davo's full-sized avatar
🏠

Davo Galavotti davo

🏠
View GitHub Profile
@davo
davo / optix_check.py
Created January 19, 2024 14:34
Check if NVIDIA Optix is available from Blender
import bpy
# Function to check if OptiX is available
def is_optix_available():
prefs = bpy.context.preferences
cprefs = prefs.addons['cycles'].preferences
cprefs.get_devices()
for device in cprefs.devices:
if 'OPTIX' in device.type:
return True
@davo
davo / doyle.js
Last active December 27, 2023 01:21 — forked from robinhouston/index.html
Stumbling blocks
/* Numerics for Doyle spirals.
* Robin Houston, 2013
*/
(function() {
var pow = Math.pow,
sin = Math.sin,
cos = Math.cos,
pi = Math.PI;
@davo
davo / doyle.js
Last active December 27, 2023 01:11 — forked from robinhouston/index.html
Spiral triangles
/* Numerics for Doyle spirals.
* Robin Houston, 2013
*/
(function() {
var pow = Math.pow,
sin = Math.sin,
cos = Math.cos,
pi = Math.PI;
@davo
davo / doyle.js
Last active December 27, 2023 01:18 — forked from robinhouston/doyle.js
Doyle spiral circle packing
/* Numerics for Doyle spirals.
* Robin Houston, 2013
*/
(function() {
var pow = Math.pow,
sin = Math.sin,
cos = Math.cos,
pi = Math.PI;
@davo
davo / grid.jsx
Last active January 24, 2023 15:31
Maxime's Grid
import { OrbitControls, useFBO } from "@react-three/drei";
import { Canvas, useFrame } from "@react-three/fiber";
import { useMemo, useRef } from "react";
import * as THREE from "three";
import { v4 as uuidv4 } from "uuid";
import "./scene.css";
import vertexShader from "./vertexShader";
import fragmentShader from "./fragmentShader";
@davo
davo / sync.js
Created January 21, 2023 05:26 — forked from seanriceaz/sync.js
Sync figma layer images up to a firebase bucket
// NOTE: This expects a few things to be stored in a .env file:
// FBKEY=xxxxxxxxx
// FIGMAPERSONALTOKEN=xxxxxxxxxxx
// GOOGLE_APPLICATION_CREDENTIALS=/users/your.name/googlekeys/firebase-storage.json
const axios = require('axios');
const dotenv = require('dotenv');
const Storage = require('@google-cloud/storage');
{"glyphs":{"0":{"ha":897,"x_min":0,"x_max":0,"o":"m 449 -17 b 78 505 215 -16 78 174 b 449 1024 79 834 217 1024 b 819 505 680 1024 819 833 b 449 -17 819 174 682 -17 m 449 115 b 667 505 585 115 667 252 b 449 895 667 756 584 895 b 230 505 313 895 230 756 b 449 115 230 252 312 115 "},"1":{"ha":656,"x_min":0,"x_max":0,"o":"m 480 0 l 327 0 l 327 857 l 322 857 l 80 699 l 80 845 l 332 1010 l 480 1010 "},"2":{"ha":852,"x_min":0,"x_max":0,"o":"m 97 110 l 439 465 b 601 733 547 580 601 644 b 420 897 601 834 523 897 b 242 717 311 897 241 826 l 96 717 b 423 1024 96 902 234 1024 b 746 737 614 1024 746 900 b 508 348 746 624 693 535 l 307 138 l 307 131 l 762 131 l 762 0 l 97 0 "},"3":{"ha":895,"x_min":0,"x_max":0,"o":"m 449 -14 b 92 263 245 -14 99 99 l 247 263 b 448 117 253 174 338 117 b 652 282 567 117 652 184 b 431 455 652 384 571 455 l 346 455 l 346 579 l 431 579 b 621 741 543 579 621 643 b 451 897 621 834 554 897 b 261 748 352 897 264 840 l 113 748 b 453 1024 118 912 267 1024 b 768 749 647 1024 769 897 b 595 525 769 635 7
@davo
davo / troubleshooting_shaders.md
Last active October 19, 2022 19:55
Using Lygia shaders with web technologies

Shaders: fetching / parsing strategies on web based REPLs

  • vite-glsl: Using this Vite plugin to import local dependencies, or load inline shaders. Github Repo by Ustym Ukhman.

  • glslfy: Node module based, combined with babel-parse-glsl allows to inject shaders with dependencies declared on the package.json. Commonly used in three.js & react-three-fiber. Github Repo part of the Stack.gl project.

  • glslify-loader: glslify loader module for webpack. Commonly used with React-based frameworks like Next.js. Github Repo.

  • html script: via scrip tag with x-script attribute. Common among old three.js articles. Demo: Minimal three.js shader example by Kyle McDonald.

@davo
davo / stable-diffusion_weights_to_google_colab.py
Last active October 30, 2023 16:16
Saving the Stable Diffusion model weights to Google Drive.
# The Stable Diffusion model weights is a bit heavy (+4GB) to download and upload to Google Colab.
# Here the steps you'll need to follow to make clone the repo using Git LFS.
# Install git-lfs on Google Colab and clone the Stable Diffusion repo from the Hugging Face.
# https://huggingface.co/CompVis/stable-diffusion-v-1-4-original/blob/main/sd-v1-4.ckpt
!git lfs install --system --skip-repo
!git clone https://USER:@HUGGINGFACE_TOKEN@huggingface.co/CompVis/stable-diffusion-v-1-4-original
# Copy the model weights to Google Drive
@davo
davo / .block
Last active May 1, 2022 00:23 — forked from d3noob/.block
Filtering in v7
license: mit