Skip to content

Instantly share code, notes, and snippets.

func print_tabular(data:Array):
# 'data' should be: [name:String, values:Array, ...]
var col_count:int = data.size()/2
var col_titles := PackedStringArray()
var col_strings:Array = []
var col_widths := PackedInt32Array()
var row_count:int = 0
for j in col_count:
var title:String = str(data[2*j])
var width:int = title.length()
@vfig
vfig / fpuzzles-solution.user.js
Created November 20, 2022 08:00 — forked from killroy42/fpuzzles-solution.user.js
Allows setters to specify a solution to the puzzle, which is checked in solve mode when the final digit is entered.
// ==UserScript==
// @name Fpuzzles-Solution
// @namespace http://tampermonkey.net/
// @version 1.6
// @description Can input a solution to a puzzle
// @author Rangsk
// @match https://*.f-puzzles.com/*
// @match https://f-puzzles.com/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
@vfig
vfig / lockview.py
Created September 23, 2022 15:17 — forked from Fweeb/lockview.py
Blender add-on for exposing the 3D View's rotation locking feature
# ***** 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
@vfig
vfig / status_bar_mode_color.py
Last active September 18, 2022 14:08
Blender: show current mode with status bar colors
bl_info = {
"name": "Status Bar Mode Color",
"author": "Dspazio / vfig",
"version": (1, 0),
"blender": (2, 80, 0),
"location": "View3D",
"description": "Changes background gradient color for each mode.",
"warning": "",
"doc_url": "",
"category": "Themes",
@vfig
vfig / polyfit_colorramp.py
Created June 29, 2022 10:12
fit 5th degree polynomial to color ramp values
import numpy as np
from numpy.polynomial import Polynomial
from numpy.polynomial.polynomial import polyval
# colorramp rgb values at steps of 1/16 from 0.0 to 1.0:
colors = [
(45,24,40),
(42,77,117),
(25,120,170),
(24,158,205),
# blitting (y, x; remember y is bottom up in blender, which is fine)
atlas = bpy.data.images.new(name='Atlas', width=256, height=256, alpha=False, float_buffer=False)
px0 = np.array(im0.pixels)
px1 = np.array(im1.pixels)
pxa = np.array(atlas.pixels)
px0.shape = (64,64,4)
px1.shape = (64,64,4)
pxa.shape = (256,256,4)
pxa[ 0:64, 0:64, : ] = px0
pxa[ 0:64, 64:128, : ] = px1
@vfig
vfig / cc.fx
Created August 23, 2021 17:07
bad eye melting effect
// to use this, copy the file to the "shaders" directory and rename it to cc.fx
static const float3 LUMINANCE_VECTOR = float3(0.2125, 0.7154, 0.0721);
float g_fGamma;
float g_fSaturation;
float g_fContrast;
float g_fBrightness;
float4 g_fColorFilter;
float2 g_fScreenSize;
; Runs a fake timelapse by showing the map assembled brush by brush.
SetTitleMatchMode, 1
IfWinNotExist, DromEd
return
WinActivate, DromEd
Send :set_lighting_mode 1{Enter}
Send :set_lighting_depth 16{Enter}
Send :compress_br_ids{Enter}
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"net/url"
"os/exec"
"strconv"
@vfig
vfig / LegacyDocsets.md
Created January 2, 2020 14:37 — forked from fzwo/LegacyDocsets.md
Download and view old Apple developer documentation

How to download and view legacy documentation from Apple (no need to sign in to your dev account).

  1. Go to https://developer.apple.com/library/downloads/docset-index.dvtdownloadableindex
  2. Find the docset you want (there are some with URL https://apple.com/none.dmg; ignore them - you will find them again further down the file with a working URL).
  3. Download the dmg. It's probably around a gigabyte or so.
  4. "Install" the .pkg file somewhere on your disk. If you don't trust the installer, do it manually:
    1. Find the largest file, names Payload, and extract it using The Unarchiver.
    2. This created a new, even larger file, probably named Payload-1.
    3. Extract Payload-1 using The Unarchiver.
  5. After many minutes of extracting, we have our .docset file.