Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
import math
import sys
from moviepy.editor import AudioClip, VideoFileClip, concatenate_videoclips
# Get average RGB of part of a frame. Frame is H * W * 3 (rgb)
# Assumes x1 < x2, y1 < y2
@savage69kr
savage69kr / pico8jstocart.py
Created June 16, 2022 06:47 — forked from eevee/pico8jstocart.py
Python script to convert exported JavaScript back into a PICO-8 cartridge
import os.path
import re
import sys
# LZ-ish decompression scheme borrowed from picolove:
# https://github.com/gamax92/picolove/blob/master/cart.lua
compression_map = b"\n 0123456789abcdefghijklmnopqrstuvwxyz!#%(){}[]<>+=/*:;.,~_"
def decompress(code):
lua = bytearray()
// c# companion script
// SpriteUVToShader.cs -------------------------------------------------------------------------------------------------------------------------------- //
// Save you your project, add to your SpriteRenderer gameObject
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
[ExecuteInEditMode]
@savage69kr
savage69kr / Program.cs
Created May 13, 2022 16:12 — forked from simonmoreau/Program.cs
A C# console app implementing the Wave Function Collapse algorithm
using System;
using System.IO;
using Microsoft.VisualBasic.FileIO;
using System.Collections.Generic;
using System.Linq;
using ExtensionMethods;
using System.Text;
namespace WFC
{
//single file version of https://github.com/kchapelier/wavefunctioncollapse
function randomIndice (array, r) {
var sum = 0,
i,
x;
for (i = 0; i < array.length; i++) {
sum += array[i];
}
@savage69kr
savage69kr / xsection.c
Created April 28, 2022 05:46 — forked from jtsiomb/xsection.c
Example of rendering cross-sections of closed geometry with OpenGL
/* Example of rendering cross-sections of closed non-self-intersecting geometry
* with the stencil buffer. See draw_cross_section for details.
*
* Controls:
* - rotate object by dragging with the left mouse button
* - move cross-section plane back and forth by dragging up/down with the right
* mouse button
*
* Compile with: cc -o xsection xsection.c -lGL -lGLU -lglut
*
@savage69kr
savage69kr / scanner.sh
Created April 20, 2022 03:58 — forked from andyrbell/scanner.sh
Make a pdf look scanned using ImageMagick
# use ImageMagick convert
# the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf
convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf
@savage69kr
savage69kr / README.MD
Created April 14, 2022 08:50 — forked from RichardBronosky/README.MD
cb - A leak-proof tee to the clipboard - Unify the copy and paste commands into one intelligent chainable command.

cb

A leak-proof tee to the clipboard

This script is modeled after tee (see [man tee][2]) and works on Linux, macOS, Cygwin, WSL/WSL2

It's like your normal copy and paste commands, but unified and able to sense when you want it to be chainable.

This project started as an answer to the StackOverflow question: [How can I copy the output of a command directly into my clipboard?][3]

@savage69kr
savage69kr / pnginator.rb
Created April 12, 2022 07:03 — forked from gasman/pnginator.rb
pnginator: pack Javascript into a self-extracting PNG
#!/usr/bin/env ruby -w
# pnginator.rb: pack a .js file into a PNG image with an HTML payload;
# when saved with an .html extension and opened in a browser, the HTML extracts and executes
# the javascript.
# Usage: ruby pnginator.rb input.js output.png.html
# By Gasman <http://matt.west.co.tt/>
# from an original idea by Daeken: http://daeken.com/superpacking-js-demos
@savage69kr
savage69kr / minimal.rs
Created April 12, 2022 06:58 — forked from cpdt/minimal.rs
A minimal Rust file with no_std for sizecoding (4k, 8k, 64k, etc)
#![no_std]
#![no_main]
#![feature(core_intrinsics, lang_items, link_args, alloc, alloc_error_handler)]
#[allow(unused_attributes)]
#[link_args = "/NODEFAULTLIB /SUBSYSTEM:WINDOWS /SAFESEH:NO /DYNAMICBASE:NO /ENTRY:WinMainCRTStartup /LTCG support/msvcrt.lib"]
extern "C" {}
#[macro_use]
extern crate alloc;