Skip to content

Instantly share code, notes, and snippets.

from bpy import data as D, context as C
import bmesh
import math
def fibonacci_points(count=32, radius=0.5):
"""
Distributes points on a sphere according to
the golden ratio, (1.0 + sqrt(5.0)) / 2.0.
"""
@sadernalwis
sadernalwis / concave_object_to_convex_objects_by_face.py
Created September 8, 2022 14:36 — forked from GuyPaddock/concave_object_to_convex_objects_by_face.py
Blender 2.91 Script for Convex Hull Decomposition into Separate Shapes Using Blender's Convex using "Split Concave Faces"
##
# A script to split simple, architectural geometry into convex pieces.
#
# This script makes use of Blender's built-in "Split Concave Faces" clean-up
# algorithm to break-up the faces of an object into convex pieces. The script
# attempts to identify all the edges that represent convex boundaries, and then
# it splits objects up along those edges. Each resulting piece is then made into
# a closed object by converting it into a convex hull.
#
# Be sure to select the object you wish the split into convex pieces before
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@sadernalwis
sadernalwis / bezier_coil.py
Created July 22, 2022 11:43 — forked from pcote/bezier_coil.py
Blender addon that generates coiled bezier curves.
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@sadernalwis
sadernalwis / FitFillTest.js
Created March 20, 2022 23:08 — forked from bartwttewaall/FitFillTest.js
Fit, fill, stretch a texture on a mesh when given the mesh's aspect ratio
import {
Object3D,
Cache,
Texture,
PlaneGeometry,
MeshLambertMaterial,
Mesh,
ClampToEdgeWrapping,
RepeatWrapping,
MirroredRepeatWrapping,
@sadernalwis
sadernalwis / Tornado webserver MJPEG streamer
Created February 15, 2022 16:21 — forked from mstaflex/Tornado webserver MJPEG streamer
Python Tornado webserver that streams JPEGs (in img/) as MJPEG-Stream using asynchronous timed callbacks (yields), being able to handly many different streams at the same time
import tornado.ioloop
import tornado.web
import gen
import time
import os
import tornado
file_list = os.listdir("img")
counter = 0
""" Every 100ms, sample from a Bernoulli and write the value to a WebSocket. """
import random
import tornado.ioloop
import tornado.web
import tornado.websocket
class WebSocketServer(tornado.websocket.WebSocketHandler):
"""Simple WebSocket handler to serve clients."""
""" Stream data from the WebSocket and update the Beta posterior parameters online. """
import tornado.ioloop
import tornado.websocket
class WebSocketClient:
def __init__(self, io_loop):
self.connection = None
self.io_loop = io_loop
@sadernalwis
sadernalwis / website-dl.md
Created October 16, 2021 16:37 — forked from stvhwrd/website-dl.md
Download an entire website for offline use with wget. Internal inks will be corrected so that the entire downloaded site will work as it did online.

The best way to download a website for offline use, using wget

There are two ways - the first way is just one command run plainly in front of you; the second one runs in the background and in a different instance so you can get out of your ssh session and it will continue.

First make a folder to download the websites to and begin your downloading: (note if downloading www.SOME_WEBSITE.com, you will get a folder like this: /websitedl/www.SOME_WEBSITE.com/)


STEP 1:

@sadernalwis
sadernalwis / log.py
Created March 18, 2021 07:31 — forked from tamask/log.py
Route system output (stdout/stderr) of Blender to the app console (put in scripts/startup)
import os
import sys
import bpy
output = None
input = None
info = None
error = None
write = None