Skip to content

Instantly share code, notes, and snippets.

View kidGodzilla's full-sized avatar
👋
Working from home forever

James Futhey kidGodzilla

👋
Working from home forever
View GitHub Profile
@kidGodzilla
kidGodzilla / discover-feed.js
Created July 6, 2025 00:07
A Bluesky Discover Feed
#!/usr/bin/env node
require('dotenv').config();
const express = require('express');
const cors = require('cors');
const postgres = require('postgres');
const WebSocket = require('ws');
const fs = require('fs');
const path = require('path');
import torch
from PIL import Image
import open_clip
# Choose device – M1 uses "mps" (Metal Performance Shaders)
device = "mps" if torch.backends.mps.is_available() else "cpu"
# Load model
model, preprocess, _ = open_clip.create_model_and_transforms(
"MobileCLIP-B", pretrained="datacompdr", device=device
#!/bin/bash
set -euo pipefail
#####################################################################################
# This Bootstrap Script installs Dokku latest on Ubuntu (use LTS or latest)
#
# This script also installs UFW (firewall), some basic Dokku plugins, and
# raises ulimits. Comment out any step you wish to skip in main.
#
# IMPORTANT: This script also disables password authentication via SSH for
@kidGodzilla
kidGodzilla / barkov-chain.js
Last active April 21, 2025 08:11
🐶 Barks Endlessly (2nd order markov chain but barking)
// Barks endlessly in your console (Paste it in)
(function () {
class MarkovChainGenerator {
constructor(tokens, order = 2) {
this.order = order;
this.model = new Map();
for (let i = 0; i <= tokens.length - order; i++) {
const key = tokens.slice(i, i + order).join(',');
const next = tokens[i + order];
@kidGodzilla
kidGodzilla / flex-center-component.html
Created March 19, 2025 07:21
Flexbox center a div (wrong answers only)
<script>
class FlexCenter extends HTMLElement {
constructor() {
super();
const shadow = this.attachShadow({ mode: 'open' });
const wrapper = document.createElement('div');
wrapper.classList.add('center');
const slot = document.createElement('slot');
@kidGodzilla
kidGodzilla / chunked-video-uploads.js
Created December 19, 2024 07:40
Chunked video uploads frontend/backend
// Frontend
const fileInput = document.querySelector('input[name="video"]');
const file = fileInput.files[0];
const chunkSize = 10 * 1024 * 1024; // 10MB
const totalChunks = Math.ceil(file.size / chunkSize);
for (let chunk = 0; chunk < totalChunks; chunk++) {
const start = chunk * chunkSize;
const end = Math.min(start + chunkSize, file.size);
const blob = file.slice(start, end);
#!/bin/bash
set -e
######################################################################
# This simple backup script generates commands to recreate dokku apps
#
# It creates the app, adds domains, and restores configuration for each app
# It does not handle databases, persistent storage, or other plugin settings
#
# Usage: Run this script on a Dokku server (you must either be logged in as the
@kidGodzilla
kidGodzilla / pdf2png.sh
Last active May 20, 2024 07:03
PDF to PNG Script for Quickdrop App
# PDF to PNG shell script for Quickdrop app
# https://quickdrop.antran.app/
# pdfburst shell script
# chmod 0755 pdfburst
#!/usr/bin/swift
import Foundation
import PDFKit
@kidGodzilla
kidGodzilla / random-name.js
Created November 12, 2018 00:07
Generate a random name in adj-noun format as a placeholder (aquatic ninja, calculating banjo, etc.)
function randomName () {
var adjectives = "aback,abaft,abandoned,abashed,aberrant,abhorrent,abiding,abject,ablaze,able,abnormal,aboard,aboriginal,abortive,abounding,abrasive,abrupt,absent,absorbed,absorbing,abstracted,absurd,abundant,abusive,acceptable,accessible,accidental,accurate,acid,acidic,acoustic,acrid,actually,adHoc,adamant,adaptable,addicted,adhesive,adjoining,adorable,adventurous,afraid,aggressive,agonizing,agreeable,ahead,ajar,alcoholic,alert,alike,alive,alleged,alluring,aloof,amazing,ambiguous,ambitious,amuck,amused,amusing,ancient,angry,animated,annoyed,annoying,anxious,apathetic,aquatic,aromatic,arrogant,ashamed,aspiring,assorted,astonishing,attractive,auspicious,automatic,available,average,awake,aware,awesome,awful,axiomatic,bad,barbarous,bashful,bawdy,beautiful,befitting,belligerent,beneficial,bent,berserk,best,better,bewildered,big,billowy,bite-Sized,bitter,bizarre,black,black-And-White,bloody,blue,blue-Eyed,blushing,boiling,boorish,bored,boring,bouncy,boundless,brainy,brash,brave,brawny,
@kidGodzilla
kidGodzilla / dokku_on_digital_ocean.md
Created October 25, 2020 06:43 — forked from henrik/dokku_on_digital_ocean.md
Notes from running Dokku on Digital Ocean.

My notes for Dokku on Digital Ocean.

These may be a bit outdated: Since I originally wrote them, I've reinstalled on a newer Dokku and may not have updated every section below.

Commands

Install dokku-cli (gem install dokku-cli) for a more Heroku-like CLI experience (dokku config:set FOO=bar).

# List/run commands when not on Dokku server (assuming a "henroku" ~/.ssh/config alias)

ssh henroku dokku