Skip to content

Instantly share code, notes, and snippets.

View lancejpollard's full-sized avatar
😍
Lots of coding

Lance Pollard lancejpollard

😍
Lots of coding
View GitHub Profile
@lancejpollard
lancejpollard / example.ts
Created August 3, 2024 23:48
Groq and easy LLaMa in Node.js
import 'dotenv/config'
import { generateText } from 'ai'
import { createOpenAI as createGroq } from '@ai-sdk/openai'
import fs from 'fs/promises'
import _ from 'lodash'
const wait = ms => new Promise(res => setTimeout(res, ms))
const groq = createGroq({
@lancejpollard
lancejpollard / readme.md
Last active July 27, 2024 17:41
Run Llama model 3.1 REST API with Python and Node.js

Code

Installation.

$ mlc_llm serve HF://mlc-ai/Llama-3.1-8B-Instruct-q4f32_1-MLC
import fs from 'fs/promises'
@lancejpollard
lancejpollard / readme.md
Last active July 23, 2024 08:17
Experience is the Foundation of Words

Experiences in English

Words are derived from base experiences. The base of a word is actually the experience it represents.

In English, we don't have direct words for the things of experience, instead we at least subdivide experiences into:

  • actions (verbs)
  • objects (nouns)
  • features (adjectives, adverbs, and prepositions)
@lancejpollard
lancejpollard / parse.ts
Last active July 9, 2024 02:13
Parse Tibetan Syllables (attempt)
const PREFIXES = ['ག', 'ད', 'བ', 'མ', 'འ']
const SUPERSCRIPTS = ['ར', 'ལ', 'ས']
const EXTENDED_ROOT_LETTERS = [
'ཫ',
'ཬ',
'ཁ༹',
'ག༹',
'ཕ༹',
'བ༹',
'གྷ',
@lancejpollard
lancejpollard / signlist.json
Created July 7, 2024 21:18
Cuneiform Sign List JSON (from ORACC)
{
"\u02beu4": ["\ud808\udc00"],
"a": ["\ud808\udc00"],
"aia2": ["\ud808\udc00"],
"aya2": ["\ud808\udc00"],
"barx": ["\ud808\udc00", "\ud808\udf0b"],
"buni\u014bx": ["\ud808\udc00", "\ud808\udc00\ud808\uddb9"],
"burx": [
"\ud808\udc00",
"\ud808\udc41\ud808\udd46\ud808\udc41",
@lancejpollard
lancejpollard / datetime.md
Last active April 23, 2024 09:12
Universal Time Representation (Idea)

A DateTime should really be treated as a TimeSpan which is taken as the difference from a standard reference point (like Jan 1, 1970). Something like that:

// 2024
const y2024 = { year: 2024 } | { thousand: 2, year: 24 }
// 2000BCE = -2000 - 1970
const y2000bce = { year: -3970 }
// 13.8bya
const t13_8bya = { billion: -13, million: -8 }
@lancejpollard
lancejpollard / leaf.ts
Created February 5, 2024 22:50
AWS Lambda file uploader
import _ from 'lodash'
import { ReadStream } from 'fs'
import busboy, { FileInfo } from 'busboy'
import DEBUG from 'debug'
import kink from './kink.js'
import { Event } from './router.js'
const debug = DEBUG('load-file')
export type HandleFileInput = {
@lancejpollard
lancejpollard / leaf.ts
Created February 5, 2024 19:54
BusBoy with Express, like Multer but not middleware and a little cleaner
import { Request, Response } from 'express'
import _ from 'lodash'
import { ReadStream } from 'fs'
import onFinished from 'on-finished'
import busboy, { FileInfo } from 'busboy'
import DEBUG from 'debug'
import kink from './kink.js'
const debug = DEBUG('load-file')
@lancejpollard
lancejpollard / parse.js
Last active February 21, 2024 11:42
FFmpeg data collections in JSON (filters, encoders, decoders, codecs, and formats)
const fs = require('fs')
const codecs = ` D.VI.S 012v Uncompressed 4:2:2 10-bit
D.V.L. 4xm 4X Movie
D.VI.S 8bps QuickTime 8BPS video
.EVIL. a64_multi Multicolor charset for Commodore 64 (encoders: a64multi)
.EVIL. a64_multi5 Multicolor charset for Commodore 64, extended with 5th color (colram) (encoders: a64multi5)
D.V..S aasc Autodesk RLE
D.V.L. agm Amuse Graphics Movie
D.VIL. aic Apple Intermediate Codec
@lancejpollard
lancejpollard / licences.json
Created December 17, 2023 20:37
licenses.json
{
"licenseListVersion": "ef5a479",
"licenses": [
{
"reference": "https://spdx.org/licenses/0BSD.html",
"isDeprecatedLicenseId": false,
"detailsUrl": "https://spdx.org/licenses/0BSD.json",
"referenceNumber": 532,
"name": "BSD Zero Clause License",
"licenseId": "0BSD",