Skip to content

Instantly share code, notes, and snippets.

@nin-jat
nin-jat / capture.sh
Created July 12, 2023 05:56
Some scripts to record your screen as a timelapse. Worked on an old version of pop_os It's a great base to work from to make your own utilities. Requires FFMPEG and something called slop for grabbing the window rect.
#!/bin/bash
# The size of your displays
DISPLAY_SIZE=2560,1440
# The offset, zero is left.
DISPLAY_OFFSET=2560
# The speed to watch the timelapse back at (fps).
FRAMERATE=30
@nin-jat
nin-jat / beammp.json
Created July 28, 2022 09:00
Beammp template for PufferPanel
{
"name": "BeamMP",
"display": "BeamMP",
"type": "beammp",
"install": [
{
"files": [
"https://github.com/BeamMP/BeamMP-Server/releases/latest/download/BeamMP-Server-linux"
],
"type": "download"
@nin-jat
nin-jat / projection.rs
Created June 15, 2022 10:18
screen to ray to world orthographic projection
/// Convert the cursor's screen position to a camera ray for orthographic projection.
pub fn cursor_to_world_orthographic(
camera_world: &Transform,
camera_projection: &OrthographicProjection,
window: &Window,
) -> Option<Ray> {
// Get our cursor's position or return None if no cursor exists.
let cursor = cursor_normalised(window, &camera_projection.window_origin);
if cursor.is_none() {
return None;
@nin-jat
nin-jat / glyphs.txt
Created February 21, 2022 08:50
Space Engineers Xbox Controller Gpyphs
 A
 B
 X
 Y
 Left Bumper
 Left Trigger
 Right Bumper
 Right Trigger
@nin-jat
nin-jat / template.json
Last active January 5, 2022 07:40
Pufferpanel/pufferd template for KissMP
{
"name": "KissMP",
"display": "KissMP for BeamNG",
"type": "other",
"install": [
{
"target": "installer.sh",
"text": "#!/bin/bash\n\n# Firstly, Download the latest version from github.\necho \"Downloading the latest version of kissmp from github.\"\ncurl -s https://api.github.com/repos/TheHellBox/KISS-multiplayer/releases/latest | grep -ow \"https.*releases/download.*zip\" | wget -O kissmp-latest.zip -qi -\n\necho \"Extracting kissmp-server.\"\n# Extract the executable. (linux)\nunzip -jo kissmp-latest.zip */kissmp-server\n\n# Windows\n#unzip -jo kissmp-latest.zip */kissmp-server.exe\n\necho \"Cleaning up downloaded files.\"\n# Delete the downloaded zip file.\nrm kissmp-latest.zip\n\necho \"Allow execution of server binary.\"\n# Change the permissions to allow executing.\nchmod +x kissmp-server\n\necho \"Generate the config.json\"\n# Start the server and kill it after 2 seconds to generate the json file.\ntimeout 2 ./kissmp-server > /dev/null",
"type": "writefile"
},
@nin-jat
nin-jat / miitopiaify.sh
Last active December 20, 2021 04:23
Add miitopia music to your screen recordings.
#!/bin/bash
# This script will replace the audio from your provided video with a random miitopia soundtrack.
# Change This to point to your Miitopia Original Soundtrack directory.
MIITOPIA_MUSIC="/home/tom/Videos/ffmpeg-scripts/assets/Miitopia-Original-Soundtrack"
# Great quality rips can be found here https://www.sittingonclouds.net/album/1287
# Usage: miitopiaify [input video] [output video]
#!/bin/bash
# This script content aware/steam carves frames from the provided video.
# It works by exploding each frame into a bmp. Passing each bmp through
# imgagemagick's convert-im6 program set to screw with each frame.
# The lastly, combine the frames back into a video with the audio from
# to source video file.
# As you can see, most of this script is inspired by what's found at
# https://gitgud.io/-/snippets/498, In-fact the ffprobe and last ffmpeg
@nin-jat
nin-jat / FreeCamera.gd
Last active February 12, 2025 19:12
A FreeCamera for godot. Add it to a camera node and add some input actions for WASD. Supports gamepads.
extends Camera
# How fast the camera speeds up to the moveSpeed and slows down to zero.
export var acceleration = 50.0
# The top speed of the camera.
export var moveSpeed = 8.0
# The speed of the mouse input.
export var mouseSpeed = 300.0
// This Editor extension adds a Open Terminal shortcut and menu item to the unity editor.
// Created by 45Ninjas.
// Works for unity 2019.3 running on Linux with Gnome 3.x.
// You should be smart enough to make it work for other versions or operating systems.
using System.Diagnostics;
using UnityEngine;
using UnityEditor;
using UnityEditor.ShortcutManagement;
@nin-jat
nin-jat / FileLogger.cs
Last active October 12, 2019 13:50
A Unity logger that writes to files instead of your editor console.
// Created by Those45Ninjas.
// https://gist.github.com/Those45Ninjas/0009abf8e028c0c573c16872b3500d00
using UnityEngine;
using System.IO;
using System;
public class FileLogger : ILogHandler
{
public TextWriter Writer;
public bool NeedsFlush = false;