Skip to content

Instantly share code, notes, and snippets.

View vec4me's full-sized avatar
🕹️
Makin' game stuff

Jeffrey Skinner vec4me

🕹️
Makin' game stuff
View GitHub Profile
@vec4me
vec4me / universal_formatter.py
Created September 27, 2025 10:35
A "universal" code formatter for Sublime, put into user packages for results
import sublime
import sublime_plugin
import subprocess
import re
FORMAT_COMMANDS = {
"C": ["clang-format", "-style=llvm"],
"C++": ["clang-format", "-style=llvm"],
"Python": ["yapf"],
"Lua": ["lua-format"],
// You can make ultra-mini WebView2 scenes with this, so there's no excuse not to start making WebGPU things anymore.
#define UNICODE
#define _UNICODE
#include <windows.h>
#include <WebView2.h>
ICoreWebView2Environment* g_env = NULL;
ICoreWebView2Controller* g_controller = NULL;
ICoreWebView2* g_webview = NULL;
import sublime
import sublime_plugin
class ValueSortCommand(sublime_plugin.TextCommand):
def run(self, edit):
sel = self.view.sel()[0]
sel = sublime.Region(0, self.view.size()) if sel.empty() else self.view.line(sel.begin()).cover(self.view.line(sel.end()))
lines = self.view.substr(sel).splitlines()
lines.sort() # Alphabetical sort first
# How to Use:
# 1. Set the environment variable 'SERPER_API_KEY' with your API key.
# - On Linux/macOS (bash/zsh): Run 'export SERPER_API_KEY="your_api_key_here"' in the terminal.
# - On Windows (Command Prompt): Run 'set SERPER_API_KEY=your_api_key_here' in the command prompt.
# 2. Run the Python script.
# 3. The script will search Google using the provided query and try to find a LinkedIn profile.
# - Example query: "doughboys donuts reno owner"
# 4. If a LinkedIn profile is found, it will print the URL. If no profile is found, it will print "No LinkedIn profile found."
import requests
@vec4me
vec4me / prox.py
Created September 5, 2024 00:17
Prox, a really nice wrapper for proxies and I don't know why things don't already work this way...
#!/bin/python3
import subprocess
import os
import socket
import sys
from urllib.parse import urlparse
# Ensure a proxy URL is provided as a command-line argument
if len(sys.argv) < 2:
@vec4me
vec4me / media_to_data_url.bash
Created February 8, 2024 01:23
Converts a media stream into a data url, this took a stupidly long time to figure out and I hate unix pipes after making this...
temp=`mktemp`
cat > $temp
type=`file --mime-type --brief $temp`
echo -n "data:$type;base64,`cat $temp | base64 --wrap=0`"
rm $temp
@vec4me
vec4me / no_more_aliases
Last active January 27, 2024 00:16
Stop using aliases for overriding defaults and just use .local/bin
bashrc_path="$HOME/.bashrc"
grep ^alias /home/$USER/.bashrc | while IFS= read -r line; do
# Extract alias name and value
alias_name=$(echo "$line" | cut -d '=' -f 1 | cut -d ' ' -f 2)
alias_value=$(echo "$line" | cut -d '=' -f 2- | sed "s/'//g")
echo -n "/bin/${alias_value%#*}\$@ #${alias_value#*#}" > /home/$USER/.local/bin/$alias_name
chmod +x /home/$USER/.local/bin/$alias_name
done
@vec4me
vec4me / towavpack.sh
Last active September 21, 2023 15:19
Convert your audio to WavPack in a Matroska Audio container
#!/bin/bash
# Check if FFmpeg is installed
if ! command -v ffmpeg &> /dev/null; then
echo "FFmpeg is not installed. Please install FFmpeg and try again."
exit 1
fi
# Check if a filename is provided as an argument
if [ $# -ne 1 ]; then
@vec4me
vec4me / gloadgen.py
Last active July 10, 2023 11:14
gloadgen.py is a Python script that generates code for loading OpenGL function pointers. It takes a list of OpenGL function names as input and produces gload.c and gload.h files. The generated code includes function pointer declarations and loading mechanisms specific to the platform. By using this generated code, developers can easily load Open…
# To load the OpenGL functions using the generated glLoadExtensions() function, you need to follow these steps after creating an OpenGL context in a Windows environment:
# 1. Create an OpenGL context using a windowing system such as Win32 or GLFW.
# 2. Make the OpenGL context current.
# 3. Load the OpenGL functions by calling glLoadExtensions().
# List of OpenGL function names
fnames = [
"glUseProgram",
"glCreateShader",
"glShaderSource",
static int FB[W*H];
static int OX;
static int OY;
static int DX;
static int DY;
static int R;
static int G;