Skip to content

Instantly share code, notes, and snippets.

@littletsu
littletsu / obswebsocket.lua
Last active June 10, 2024 00:17
Websocket and HTTP server for obs lua scripting
-- Based on https://github.com/stonetoad/obs-lua-httpd
local obs = obslua
-- From https://github.com/stonetoad/obs-lua-httpd/blob/e1c167f6c5231e605cf8531750153e728765f587/ljsocket.lua
local socket = require("ljsocket")
-- From https://gist.githubusercontent.com/PedroAlvesV/872a108f187f57c2a5b7b5bc34398496/raw/4ee8e36c9ee4b55a3d6bef768258ec8f9c6c3bc2/sha1.lua
local sha1 = require("sha1")
local bit = require("bit")
-- From https://devforum.roblox.com/t/base64-encoding-and-decoding-in-lua/1719860
@littletsu
littletsu / ws.js
Last active June 9, 2024 00:59
Really simple probably non-standard websocket server in nodejs using tcp server
import net from 'net';
import crypto from 'crypto';
const port = 5000;
const sha1 = function(str) {
const shasum = crypto.createHash('sha1')
shasum.update(str)
return shasum.digest().toString("base64")
}
const STATUS = {
WAITING: 0,
@littletsu
littletsu / egg.lua
Created January 30, 2024 07:40
Proof of Concept State machine for Roblox simulator egg hatching
local StateMachine = {}
export type StateMachine = typeof(StateMachine.new())
export type StateMachineEnterCallback = (previousState: string|nil) -> ()
export type StateMachineState = {
Enter: StateMachineEnterCallback?,
Exit: ((nextState: string|nil) -> ())?,
Name: string?
}
@littletsu
littletsu / userscript.js
Created December 31, 2023 00:49
Better titles for FFmpeg doxygen
// ==UserScript==
// @name Better titles for FFmpeg doxygen
// @namespace Violentmonkey Scripts
// @match https://ffmpeg.org/doxygen/*
// @grant none
// @version 1.0
// @author -
// @description 12/30/2023, 2:32:16 AM
// ==/UserScript==
(() => {
@littletsu
littletsu / config
Last active December 14, 2022 18:51
i3 config
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
@littletsu
littletsu / config
Last active August 28, 2022 05:36
Sway config
# Default config for sway
#
# Copy this to ~/.config/sway/config and edit it to your liking.
#
# Read `man 5 sway` for a complete reference.
### Variables
#
# Logo key. Use Mod1 for Alt.
set $mod Mod1
@littletsu
littletsu / fonts.sh
Last active December 14, 2022 06:29
fonts
doas pacman --needed -S terminus-font ttf-croscore ttf-dejavu gnu-free-fonts ttf-liberation libertinus-font noto-fonts adobe-source-code-pro-fonts cantarell-fonts ttf-opensans noto-fonts-cjk noto-fonts-emoji ttf-jetbrains-mono
# Terminal: JetBrains Mono Regular 14.0
@littletsu
littletsu / download.js
Created February 19, 2022 09:01
Bulk Download Urls in Node.js
import fs from 'fs';
import fetch from 'node-fetch';
// urls.txt should be a text file containing the urls separated by a new line
const file = fs.readFileSync('./urls.txt', {'encoding': 'utf8'}).split('\n');
file.forEach(url => {
fetch(url).then(res => {
// modify to whichever format the downloads are
let write = fs.createWriteStream(`./urls/${Date.now()}.webp`);
@littletsu
littletsu / download.js
Created February 19, 2022 09:00
Bulk Download Urls in Node.js
import fs from 'fs';
import fetch from 'node-fetch';
// urls.txt should be a text file containing the urls separated by a new line
const file = fs.readFileSync('./urls.txt', {'encoding': 'utf8'}).split('\n');
file.forEach(url => {
fetch(url).then(res => {
// modify to whichever format the downloads are
let write = fs.createWriteStream(`./urls/${Date.now()}.webp`);
@littletsu
littletsu / dunstrc
Created January 12, 2022 02:38
personal dunst config
# See dunst(5) for all configuration options
[global]
### Display ###
# Which monitor should the notifications be displayed on.
monitor = 0
# Display notification on focused monitor. Possible modes are:
# mouse: follow mouse pointer