Skip to content

Instantly share code, notes, and snippets.

@Alloyed
Alloyed / winampOnCohost.user.js
Last active March 24, 2024 20:56
Embeds a whole winamp instance on your cohost feed, when audio embeds are detected. All audio files on the page are added to a playlist and can be queued one after the other, or shuffled. (+any other winamp features like eq/panning)
// ==UserScript==
// @name Winamp on Cohost
// @namespace Violentmonkey Scripts
// @match https://cohost.org/*
// @noframes
// @require https://unpkg.com/webamp
// @grant GM.addElement
// @version 0.2
// @author https://cohost.org/alloyed
// @description 3/9/2024, 6:06:50 PM: Embeds a whole winamp instance on your cohost feed, when audio embeds are detected. All audio files on the page are added to a playlist and can be queued one after the other, or shuffled. (+any other winamp features like eq/panning)
@Alloyed
Alloyed / ugh.md
Last active April 28, 2021 03:49
how to install luarocks on windows in 2020 :(
  1. get python (lol). make sure you check the box that says "add python to PATH", this will be important later

https://www.python.org/

  1. get a visual studio compiler. make sure to select either desktop development with C++ or, game dev with C++, or both~

https://visualstudio.microsoft.com/downloads/

  1. open a native tools command prompt: select x64 native tools command prompt for VS2019 from the start menu
// itch api
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "snake_case")]
struct ItchUser {
username: String,
display_name: String,
id: u32,
}
#[derive(Serialize, Deserialize, Debug)]
--- Parseimg, v0.1
--
-- A library for turning love2d ImageData into high-level datastructures.
--
-- MIT License
--
-- Copyright (c) 2017 Kyle McLamb <alloyed@tfwno.gf>
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
#!/usr/bin/python3
"""Reads from argument the log file name. And displays it in real time.
The default log name is log.txt (which is correct if the script is launched
from the afterbirth folder itself)
It will read each line one after the other on an infinit loop.
If the file gets updated (ie: a line is added) it will display it and
lower the reading cooldown.
If nothing happen on the reading loop, it increase the reading cooldown.
--- A log function that's compatible with lua's standard print function.
-- usage: print("hi", table, entity, 3.4) -- output: hi <table:0xdeadbeef> <userdata:0xeeeeeeee> 3.4
local function print(...)
local str, sep = "", ""
for i=1, select('#', ...) do
str = str .. sep .. tostring(select(i, ...))
sep = '\t'
end
return Isaac.DebugString(str)
end
path,  err = nfd.open(filter, init) -- lets you pick a single file
paths, err = nfd.openMany(filter, init) -- lets you pick multiple files
path,  err = nfd.save(filter, init) -- lets you save to a single file

where:

  • filter (string, optional): A weird DSL for filetypes you probably shouldn't emulate. it supports type subgroups (so like jpg files are "jpg,jpeg" and so on) but doesn't let you name them. defaults to all files.
  • init (string, optional): The initial path the file chooser should suggest. Normally this is a directory, but for save() you can suggest an initial filename like "/my/path/untitled.file". defaults to the working directory.
local gold = true
this_is.gold = false
this_is = {
gold = true
}
call(gold)
@Alloyed
Alloyed / aseprite.thumbnailer
Created February 19, 2016 05:32
Aseprite Thumbnailer
[Thumbnailer Entry]
TryExec=aseprite
Exec=sh -c "aseprite -b %i --scale 4 --save-as %o.gif && mv %o.gif %o"
MimeType=application/x-wine-extension-ase;application/x-extension-ase
@Alloyed
Alloyed / dwarfify.lua
Created December 7, 2014 00:22
Automatically gives dwarves nicknames
-- Automatically gives dwarves nicknames
local NICK_MAXLEN = 40
function get_dorfs()
local used_names = {}
local new_dorfs = {}
for _, u in ipairs(df.global.world.units.active) do
if dfhack.units.isCitizen(u) then
if u.name.nickname ~= "" then
used_names[u.name.nickname] = true