Skip to content

Instantly share code, notes, and snippets.

View tatarize's full-sized avatar

tatarize

View GitHub Profile
@tatarize
tatarize / vnoise.py
Created February 22, 2021 11:00
vnoise port of `noise` project c-code into python.
# Code is derived from the C noise code:
# Copyright (c) 2008, Casey Duncan (casey dot duncan at gmail dot com)
# MIT LICENSE.
# This port is also, MIT LICENSE.
from numpy import floor, fmod
M_1_PI = 0.31830988618379067154
@tatarize
tatarize / vnoise.py
Created February 22, 2021 11:28
vnoise all functions ported.
# Code is derived from the C noise code:
# Copyright (c) 2008, Casey Duncan (casey dot duncan at gmail dot com)
# MIT LICENSE.
# This port is also, MIT LICENSE.
from numpy import floor, fmod
"""
"Native-code tileable Perlin "improved" noise functions"
@tatarize
tatarize / vsnoise.py
Created February 25, 2021 14:25
Port of simplex noise from pypi:noise
"""
// Copyright (c) 2008, Casey Duncan (casey dot duncan at gmail dot com)
// see LICENSE.txt for details
// $Id$
"""
import sys # Only needed for FLT_MAX, FLT_MAX is semaphore; replace with None
import numpy as np
@tatarize
tatarize / head.out.svg
Created April 23, 2021 20:56
head image converted with potrace
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tatarize
tatarize / crash_demo.py
Created May 31, 2021 04:48
Crash Demo -- Load with Linux wx.Python 4.1.1 press the expand arrow for either Shapes or Selection. Segfault.
import wx.aui
import wx
import wx.ribbon as RB
ID_CIRCLE = wx.ID_HIGHEST + 1
ID_CROSS = ID_CIRCLE + 1
ID_TRIANGLE = ID_CIRCLE + 2
ID_SQUARE = ID_CIRCLE + 3
ID_POLYGON = ID_CIRCLE + 4
ID_SELECTION_EXPAND_H = ID_CIRCLE + 5
@tatarize
tatarize / colorclusters.py
Last active February 14, 2022 15:29
Process color distances to find max color distances between all different colors.
import math
from copy import deepcopy
from functools import lru_cache
from PIL import ImageDraw, Image
# Color conversion formula borrowed from:
# http://www.easyrgb.com/index.php?X=MATH&H=02#text2
ref_X = 95.047 # ref_X = 95.047 Observer= 2°, Illuminant= D65
ref_Y = 100.000 # ref_Y = 100.000
@tatarize
tatarize / calc_colors.py
Created February 13, 2022 20:18
Calculate color lists for various numbers of equidistant colors.
import math
from copy import deepcopy
from functools import lru_cache
from PIL import ImageDraw, Image
from random import Random
r = Random()
# Color conversion formula borrowed from:
@tatarize
tatarize / point_in_polygon.py
Created January 2, 2023 03:15
Fast scanbeam point in polygon code
def build_edge_list(polygon):
edge_list = []
for i in range(0, len(polygon) - 1):
if (polygon[i].imag, polygon[i].real) < (polygon[i + 1].imag, polygon[i + 1].real):
edge_list.append((polygon[i], i))
edge_list.append((polygon[i + 1], ~i))
else:
edge_list.append((polygon[i], ~i))
edge_list.append((polygon[i + 1], i))

Spreadsheet-to-Keystrokes Script

This script is designed to automate the process of inputting data from a spreadsheet into a program that only allows input one field at a time. By reading an exported file and simulating keystrokes, the script inputs each cell value into the corresponding field in the program.

The script is simple and easy to use, with no complicated setup or configuration required. All you need to do is prepare the data in a tab-delimited text file, open the order entry system, and drag and drop the file onto the script, then select the first field in the program. The script will wait three seconds then automatically input the data for you.

Prerequisites

We are assuming you are running Microsoft Windows with VBScript (it comes standard). If this is inaccurate, a python example is also provided.

Assumptions

We are assuming that you can press tab to move to the next field, and that pressing enter will move to the next line.

@tatarize
tatarize / readme.md
Last active April 10, 2023 21:17
Spreadsheet to Auto Entry

Spreadsheet to Auto Entry

This script should allow you to enter data in a custom ordering with special keypresses and allow some customization and development on-the-fly. Each line you will be prompted to give the desired ordering for the sendkeys, if you edit it. It will reflect this for the next attempt. When you have a working ordering for the keystrokes, you can rename the script file to that ordering name and it will be used as the default ordering.

The replacement variables $1 - $n are presented for each line.

Instructions

  1. Open the spreadsheet containing the data you want to enter into the program.
  2. Save the spreadsheet data in a Tab Delimited format.