Skip to content

Instantly share code, notes, and snippets.

View 505e06b2's full-sized avatar

505e06b2

View GitHub Profile
@505e06b2
505e06b2 / autoclicker.py
Last active September 1, 2023 12:26
X11 Autoclicker
#!/usr/bin/env python3
import time
import argparse
#python3 -m pip install python-xlib
from Xlib import X
from Xlib.display import Display
from Xlib.ext.xtest import fake_input
from Xlib.XK import XK_Scroll_Lock
@505e06b2
505e06b2 / shebang.py
Last active November 29, 2022 22:11
Shebang proxy, specifically for Windows
#!/usr/bin/env python
import os, sys
import subprocess, shutil, shlex
from pathlib import Path
def getShebangLine(executable_path):
with open(executable_path, "rb") as f:
magic = f.read(2)
if magic != b"#!":
@505e06b2
505e06b2 / kissascii.mjs
Created September 4, 2022 18:43
Lossy ASCII compression
"use strict";
export const settings = {
debug: false
};
function padBits(bit_string, divisible_by) {
const is_divisible = bit_string.length % divisible_by === 0;
if(is_divisible) {
return bit_string;
@505e06b2
505e06b2 / launchpad_clock.py
Created August 5, 2022 19:17
Launchpad Clock (for Novation Launchpad Mini)
#!/usr/bin/env python2
import launchpad_rtmidi_py as launchpad
import time
lp = launchpad.Launchpad()
if not lp.Open():
print("Failed...\nReconnect...")
quadrants = [
@505e06b2
505e06b2 / audio_with_art_to_webm.py
Last active July 17, 2022 14:29
Encode audio files as webm using the album art as the video track
#!/usr/bin/env python3
import sys, subprocess, shlex, json
from pathlib import Path
temp_folder = "/tmp"
album_art_filename = Path(temp_folder, "script_album_art.jpg")
try:
audio_path = Path(sys.argv[1].strip())
@505e06b2
505e06b2 / overflow.c
Created October 21, 2020 20:03
Check for buffer overflow
#include <stdio.h>
int main() {
struct {
char buffer[sizeof(int)]; //must be word aligned or will be forced by the compiler
volatile int modified;
} container;
container.modified = 0;
@505e06b2
505e06b2 / now_playing.lua
Last active August 1, 2020 08:12
Create text files for the currently played media in MPV
folder_dir = "/tmp/" --must have a slash proceding the location - lua doesn't have a pathing stdlib
--[[
This is specifically for OBS, but can be altered pretty easily for other uses
It's mostly useful for documenting the MPV metadata grabbing functions, as they are a little bit of a hassle to find
Just to note, if a tag is not found, it will create a blank file - this should never happen with the title though
]]--
function save_file(filename, metadata)
@505e06b2
505e06b2 / parse_ogg.js
Last active June 27, 2020 00:54
Get Metadata from OggVorbis / OggOpus
"use strict";
function OggParser(file) {
const uint8 = new Uint8Array(file);
this.getMetadata = () => {
return _parseMetadataSegments( _getMetadataSegments() );
};
this.parsePage = (starting_index) => {
@505e06b2
505e06b2 / gapless_audio.js
Created June 3, 2020 17:16
Gapless HTML5 Audio
function gaplessAudio() {
const audio = new AudioContext();
let buffer_source;
this.load = async (url) => {
const file_contents = await (await fetch(url)).arrayBuffer();
audio.decodeAudioData(file_contents, function(buffer) {
if(buffer_source) buffer_source.disconnect();
buffer_source = audio.createBufferSource();
@505e06b2
505e06b2 / encode_webm.py
Created January 9, 2020 15:19
FFMPEG Webm Encoder - With Progress
#!/usr/bin/env python3
import subprocess, sys, multiprocessing, json, os, shlex, re
from datetime import timedelta
error_messages = {
"param_len": """Not enough parameters
Format: %s [input_file] (optional)[parameters] [movie_title]
"""
}