Skip to content

Instantly share code, notes, and snippets.

@RepComm
RepComm / content.js
Created January 24, 2025 19:58
goodbye_blank (removes _blank) - currently only supports bing.com, will edit in future
//content.js
function goodbye_blank() {
console.log("removing _blanks")
for (const a of document.querySelectorAll("a")) {
if (a.target == "_blank") {
a.target = "";
}
}
}
@RepComm
RepComm / yt_dl_playlist_csv_bookmarklet.js
Created January 17, 2025 15:29
Youtube Download Playlist CSV bookmarklet
javascript:(()=>{let output = 'action,url\n';for(anchor of document.querySelectorAll("a#video-title%22)){output+=%60allow,${anchor.href}\n%60;}const%20dl=document.createElement(%22a%22);dl.setAttribute(%22href%22,%22data:text/plain;charset=utf-8,%22+encodeURIComponent(output));dl.setAttribute(%22download%22,%22playlist.csv%22);dl.style.display%20=%20%22none%22;dl.click();})()
@RepComm
RepComm / fix_gltf_lights.gd
Last active August 24, 2024 21:53
@tool gdscript to fix godot blend/gltf light imports via hacks (iterate tree and scale light intensity when threshold met) - attach to a node3d (any will work), assign your scene root in the editor block, and restart godot, listens to scene add and init, as well as a manual boolean "fix now"
@tool
extends Node3D
@export
var scene: Node
@export
var light_energy_max: float = 200.0
@export
@RepComm
RepComm / EZAction.java
Created August 5, 2024 02:23
Android broadcast listener/receiver, but it's not annoying to use and smaller scope
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
/**Intent Broadcast receiver shit is too verbose, fixed it for ya*/
public class EZAction {
public static void Fire(Context ctx, String action) {
Intent intent = new Intent(action);
@RepComm
RepComm / cypher.html
Last active July 12, 2024 22:26
vigenere cipher experiment html app
<!DOCTYPE html>
<html>
<head>
<style>
body {
margin: 0;
height: 100svh;
padding: 0;
overflow: hidden;
@RepComm
RepComm / spring.gd
Last active June 30, 2024 02:43
2d spring implementation for godot v4 gdscript, simply assign a and b RigidBody2D, script doesn't have to be attached to rigidbodys, just needs to be in the scene
extends Node2D
@export
var a: RigidBody2D = null
@export
var b: RigidBody2D = null
@export
var a_affected: bool = false
@export
var b_affected: bool = false
@RepComm
RepComm / schema2jsdoc.mjs
Last active December 19, 2024 17:00
pocketbase pb_schema.json to typescript definitions ( ex usage: ./schema2jsdoc.mjs > schema.d.ts ) - runs where-ever current directory is and finds pb_schema.json, outputs to stdout, pipe to a file to save, or copy paste text
#!/usr/bin/env node
import { readFileSync } from "fs";
import { exit } from "process";
function log(...msgs) {
console.log("//", ...msgs);
}
function warn(...msgs) {
log("WARN:", ...msgs);
}
@RepComm
RepComm / sigterm.go
Created April 2, 2024 19:51
handle signal termination and interupt in golang
package common
import (
"os"
"os/signal"
"syscall"
)
func HandleSigTerm(cb func(sig os.Signal)) {
signalChannel := make(chan os.Signal, 2)
@RepComm
RepComm / autoappend.pb.js
Created February 4, 2024 00:02
pocketbase auto-append to container from created item.container reference
onModelBeforeCreate((e)=>{
const item_name = "responses";
const container_name = "tickets";
const container_ref = "ticket";
const container_id = e.model.get(container_ref);
if (container_id) {
@RepComm
RepComm / snippet.cs
Created February 1, 2024 05:07
Godot absolute force to rigidbody relative force
var upThrust = 1;
var forwardThrust = 2;
var absoluteForce = new Vector3 ( 0, upThrust, forwardThrust );
var relativeForce = absoluteForce * Basis.Transposed(); //The magic BS that makes it work
ApplyCentralForce( relativeForce );