Skip to content

Instantly share code, notes, and snippets.

View CapsAdmin's full-sized avatar
🌜
Lua

Elias Hogstvedt CapsAdmin

🌜
Lua
View GitHub Profile
View transcription.csv
start end text
0.0 9.0 Three men who previously served in the military are set to speak publicly about what they saw in this guy and heard behind closed doors.
9.0 10.0 All right, what more?
10.0 11.0 Guy and the light team.
11.0 15.0 They have let in. Fifteen people from the public.
15.0 24.0 There was David Grash, who's a former intelligence official, he has knowledge of a covert government program to recover crashed alien spacecraft.
25.0 32.0 You saw me sweared or affirm that the testimony you are about to give is the truth, though all truth and nothing but the truth. So help you guys.
32.0 39.0 That is David Grash, a former Afghanistan combat veteran in 14 year high ranking intelligence office.
39.0 40.0 Hey, how are you?
40.0 41.0 I'm a businessman.
View test.py
import gradio as gr
import torch
import numpy as np
from PIL import Image
# Define function to generate a red image
def generate_red_image(size: int=256):
# Create a tensor with random values between 0 and 1 for each color channel
image_tensor = torch.rand(3, size, size).to("cuda")
@CapsAdmin
CapsAdmin / luajit_remake_compat.lua
Last active June 3, 2023 21:02
loadfile("luajit_remake_compat.lua")() to get string, bit, require and table library implemented in lua. Intended for use with https://github.com/luajit-remake
View luajit_remake_compat.lua
-- For the string library I used https://github.com/pygy/strung.lua and removed the need for ffi.
-- My modification is not optimal at all as it's made with ffi in mind, but at least it passed its test suite and might be useful for stress testing.
-- For bit operators I used https://github.com/davidm/lua-bit-numberlua/blob/master/lmod/bit/numberlua.lua
-- for require I used https://github.com/hoelzro/lua-procure
local function find_nyi_functions()
local blacklist = {
loadfile = true,
dofile = true,
@CapsAdmin
CapsAdmin / RangeSlider.ts
Last active September 9, 2022 12:09
quick and dirty typescript version of https://github.com/githuboftigran/rn-range-slider as i just needed some sliders for debugging
View RangeSlider.ts
import React, {
memo,
MutableRefObject,
PureComponent,
RefObject,
useCallback,
useEffect,
useMemo,
useRef,
useState,
View modestack.ts
type Mode = "safe" | "faster";
const modeStack: Mode[] = ["safe"];
const getMode = () => modeStack[0];
const pushMode = (mode: Mode) => modeStack.unshift(mode);
const popMode = () => modeStack.shift();
type HasLength = { length: number };
type WithModeRequest<Result> = {
mode: Mode;
View preprocess.lua
local preprocess = {}
function preprocess.Init()
if _G.load then
_G.old_preprocess_load = _G.old_preprocess_load or _G.load
local old_preprocess_load = _G.old_preprocess_load
_G.load = function(code, name, ...)
if type(code) == "string" then
code = preprocess.Preprocess(code, name, nil, "load")
View build.sh
git clone git@github.com:LuaJIT/LuaJIT.git
cd LuaJIT
make
cd ..
gcc -O2 main.c -I LuaJIT/src/ -L LuaJIT/src/ -lluajit
./a.out main.lua
View glua.lua
type IPixVis = {}
type ISensor = {}
local CLIENT = true
local SERVER = true
local MENU = true
type IBfRead = {}
type IWeapon = {}
type IVehicle = {}
type IVector = {}
type IMatrix = {}
@CapsAdmin
CapsAdmin / spleeter.cmd
Last active March 22, 2023 11:59
This makes it possible to run spleeter without having to install pyton and pip on windows. See http://github.com/deezer/spleeter for more info on what spleeter is. Usage is `.\spleeter.cmd separate -p spleeter:5stems -o amen .\amenbrother.wav`
View spleeter.cmd
@echo off & PowerShell -nologo -noprofile -noninteractive Invoke-Expression ('$args=(''%*'').split('' '');'+'$PSScriptRoot=(''%~dp0'');$env:GOLUWA_CURRENT_DIRECTORY=(''%cd%'');'+((Get-Content -Raw '%~dp0%~n0%~x0' ) -Replace '^.*goto :EOF')); & goto :EOF
# ^^^^^
# this is some magic to execute the rest of this cmd as powershell
# so we can run it from explorer with double click or cmd easily
function Download($url, $location) {
Write-Host -NoNewline "'$url' >> '$location' ... "
(New-Object System.Net.WebClient).DownloadFile($url, "$location")
Write-Host "OK"
View loading.html
<!DOCTYPE html>
<html>
<style>
body {
background-color: black;
background-size: cover;
overflow: hidden;
opacity: 1;
transition: all 300ms ease-in 200ms;
}