Skip to content

Instantly share code, notes, and snippets.

ffmpeg -r 30 -f image2 -pattern_type glob -i "*?png" -vcodec libx264 -crf 20 -pix_fmt yuv420p output.mp4
const vec3 = {
copy: a => [a[0], a[1], a[2]],
add: (a, b) => {
a[0] += b[0]
a[1] += b[1]
a[2] += b[2]
},
sub: (a, b) => {
a[0] -= b[0]
a[1] -= b[1]
import fs from 'fs/promises'
import path from 'path'
import { Document, WebIO } from '@gltf-transform/core'
import XlsxPopulate from 'xlsx-populate'
import { tableFromArrays, tableToIPC } from 'apache-arrow'
import { fromFile } from 'geotiff'
import proj4 from 'proj4'
proj4.defs('EPSG:2193', '+proj=tmerc +lat_0=0 +lon_0=173 +k=0.9996 +x_0=1600000 +y_0=10000000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs ')
import { generate_sampling_map, generate_image, copy_to_png } from './lib/nni.js'
import { PNG } from 'pngjs'
@tcoats
tcoats / index.js
Last active October 16, 2023 02:40
import Sequencer from './sequencer.js'
const a_plan = [
['+', 'A'],
['+', 'B'],
['+', 'C'],
['-', 'B'],
['-', 'C'],
['-', 'A']
]
import { Interpolator } from 'natninter'
import { PNG } from 'pngjs'
import { createWriteStream } from 'fs'
function* range(from, to) {
while (from <= to) yield from++
}
const generate_nni = (width, height, seeds) => {
const nni = new Interpolator()
const Step = () => {
const api = {
is_stepping: false,
step_current: null,
step_release: null,
step_waiting: false,
acquire_current: null,
acquire_release: null,
acquire_waiting: false,
acquire: async () => {
@tcoats
tcoats / tracert.js
Last active January 27, 2023 00:53
import raw from 'raw-socket'
import dns from 'dns/promises'
const MAX_ID = 65535
const MAX_HOPS = 64
const TIMEOUT_MS = 2000
const tracert = async (target_host, progress_cb) => {
if (!progress_cb) progress_cb = () => {}
const session_id = Math.floor(process.pid % MAX_ID)
## Installation
# Save this file to the stablediffusion/scripts directory as api.py
# In the root directory run:
# pip3 install wheel fastapi uvicorn
# uvicorn scripts.api:app --host 0.0.0.0 --port 9090 --reload
## Test
# curl -X 'POST' http://localhost:9090/generate -H 'Content-Type: application/json' -d '{ "prompt": "New Student" }' -o image.png
import os
## Installation
# Save this file to the InvokeAI/scripts directory as api.py
# In the root directory run:
# pip3 install wheel fastapi uvicorn
# uvicorn scripts.api:app --host 0.0.0.0 --port 9090 --reload
## Test
# curl -X 'POST' http://localhost:9090/generate -H 'Content-Type: application/json' -d '{ "prompt": "New Student" }' -o image.png
import os
## Installation
# python3 -m venv venv
# source venv/bin/activate
# pip3 install wheel fastapi uvicorn
# uvicorn main:app --host 0.0.0.0 --port 8000 --reload
## Test
# curl -X 'POST' http://127.0.0.1:8000/work -H 'Content-Type: application/json' -d '{"prompt":"New Student", "seed": 24}'
# curl http://127.0.0.1:8000/status