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 / 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];
@stenuto
stenuto / hls.sh
Created November 7, 2024 16:58
HLS ffmpeg script
#!/bin/bash
# Function to display usage information
usage() {
echo "Usage: $0 /path/to/input.mp4 [ /path/to/output_directory ]"
exit 1
}
# Check if at least one argument (input file) is provided
if [ $# -lt 1 ]; then
#!/bin/bash
set -e
######################################################################
# 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.
#
# IMPORTANT: This script also disables password authentication via SSH for
@dangovorenefekt
dangovorenefekt / blockmetatwitter.md
Last active January 14, 2025 22:25
Block Meta and Twitter (nginx)
@linuxandchill
linuxandchill / retrievalQA.js
Last active June 10, 2024 16:04
Create and retrieve embeddings using Langchain and Supabase
////////////////////////////////////
/* "dependencies": {
"@supabase/supabase-js": "^2.13.1",
"langchain": "^0.0.44"
} */
////////////////////////////////////
import { OpenAI } from "langchain/llms";
import {
@kidGodzilla
kidGodzilla / openai-chat-completion.js
Last active April 5, 2024 21:15
OpenAI Chat Completion Example
const { Configuration, OpenAIApi } = require('openai');
let openai;
const instructions = ``;
if (process.env.OPEN_AI_API_KEY) {
const configuration = new Configuration({ apiKey: process.env.OPEN_AI_API_KEY });
openai = new OpenAIApi(configuration);
}
@overflowy
overflowy / favicons-hn.user.js
Last active July 12, 2023 13:12
Favicons for HN
// ==UserScript==
// @name Favicons for HN
// @namespace Violentmonkey Scripts
// @match https://*.ycombinator.com/*
// @grant none
// @version 1.0
// @author [email protected]
// @description 12/19/2022, 9:34:53 AM
// @inject-into content
// ==/UserScript==
class LineChart {
// LineChart by https://kevinkub.de/
constructor(width, height, values) {
this.ctx = new DrawContext();
this.ctx.size = new Size(width, height);
this.values = values;
}
_calculatePath() {
@moyix
moyix / killbutmakeitlooklikeanaccident.sh
Created February 5, 2022 22:51
Script to inject an exit(0) syscall into a running process. NB: only x86_64 for now!
#!/bin/bash
gdb -p "$1" -batch -ex 'set {short}$rip = 0x050f' -ex 'set $rax=231' -ex 'set $rdi=0' -ex 'cont'
@kahole
kahole / index.html
Last active October 10, 2024 20:28
*scratch*.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>*scratch*</title>
<style>
body {
font-family: Hack, Menlo, Monaco, 'Droid Sans Mono', 'Courier New', monospace;
white-space: pre;