Skip to content

Instantly share code, notes, and snippets.

View 413x1nkp's full-sized avatar
:fishsticks:
fishsticks

Alex Murkoff 413x1nkp

:fishsticks:
fishsticks
View GitHub Profile
// Rounds up to the next nearest power-of-two value
static inline unsigned int pow2_ceil( unsigned int x ) {
#if defined( __clang__ ) || defined( __GNUC__ )
return 1 + ( ( x >= 2 ) * ( ( ( 1u << 31 ) >> ( __builtin_clz( ( x - 1 ) | 1 ) - 1 ) ) - 1 ) );
#elif defined( _MSC_VER ) && ( defined( _M_IX86 ) || defined( _M_X64 ) )
return ( 1u << 31 ) >> ( __lzcnt( ( x - 1 ) | ( x == 0 ) ) - 1 );
#elif defined( _MSC_VER ) && ( defined( _M_ARM ) || defined( _M_ARM64 ) )
return ( 1u << 31 ) >> ( __clz( ( x - 1 ) | ( x == 0 ) ) - 1 );
#else
--x; // if x is already pow2, we don't want the next pow2
@MembrilloAmarillo
MembrilloAmarillo / HandmadeHero.toml
Created February 6, 2025 11:11
Handmade Hero inspired theme - Helix
"ui.background" = "#0c0c0cff" # Text area background color
"ui.text" = "#b99468ff" # UI Regular text
"ui.text.focus" = { bg = "#1E1E1Eff",fg = "#a08563ff" }
variable = "#b99468ff"
label = "#b99468ff"
comment = "#686868ff"
"ui.cursor" = { bg = "#00EE00ff", fg = "#00EE00ff"}
"ui.cursor.insert" = { bg = "#00EE00ff", fg = "#00EE00ff"}
"ui.cursor.select" = { bg = "#00EE00ff", fg = "#00EE00ff"}
keyword = "#ac7b0bff"
@mary-ext
mary-ext / bluesky.txt
Last active August 5, 2025 22:38
make bluesky good ublock filter
! remove `session_id` tracking parameter from videos
!
! ideally this would've been a redirect from `video.bsky.app/watch/<did>/<cid>/playlist.m3u8`
! to `video.cdn.bsky.app/hls/<did>/<cid>/playlist.m3u8`, as the latter is the actual CDN while
! the former is the middleware, however:
!
! - the raw playlist will not contain webvtt, that's added in by the middleware
! - ublock doesn't have a rule that allows redirecting to non-local neutered resource
!
||video.bsky.app$removeparam=session_id
@trvswgnr
trvswgnr / compress_video
Last active August 10, 2025 16:33
portable shell script to compress videos with ffmpeg
#!/bin/sh
print_usage() {
echo "usage: compress_video <input_file>"
echo "supported formats: mp4, webm, mkv, mov, avi, flv"
}
get_extension() {
f="${1##*/}"
case "$f" in
@FreyaHolmer
FreyaHolmer / GpuPrinter.cginc
Last active May 24, 2025 08:58
A unity shader .cginc to draw numbers in the fragment shader - see the first comment below for example usage!
///////////////////////////////////////////////////////////////////////////////
// ABOUT: A unity Shader .cginc to draw numbers in the fragment shader
// AUTHOR: Freya Holmér
// LICENSE: Use for whatever, commercial or otherwise!
// Don't hold me liable for issues though
// But pls credit me if it works super well <3
// LIMITATIONS: There's some precision loss beyond 3 decimal places
// CONTRIBUTORS: yes please! if you know a more precise way to get
// decimal digits then pls lemme know!
// GetDecimalSymbolAt() could use some more love/precision
@majikayogames
majikayogames / _push_away_rigid_bodies.txt
Last active August 12, 2025 09:40
Godot 4 CharacterBody3D to RigidBody3D Push Interaction Script
# CC0/public domain/use for whatever you want no need to credit
# Call this function directly before move_and_slide() on your CharacterBody3D script
func _push_away_rigid_bodies():
for i in get_slide_collision_count():
var c := get_slide_collision(i)
if c.get_collider() is RigidBody3D:
var push_dir = -c.get_normal()
# How much velocity the object needs to increase to match player velocity in the push direction
var velocity_diff_in_push_dir = self.velocity.dot(push_dir) - c.get_collider().linear_velocity.dot(push_dir)
# Only count velocity towards push dir, away from character
@maximtrp
maximtrp / Orange Pi PC and Arch Linux ARM.md
Last active September 10, 2025 22:51
Guide on how to install Arch Linux ARM on SD card for your Orange Pi PC board

Orange Pi PC & Arch Linux ARM: installation guide

This guide is based on multiple guides as well as official instructions for the other boards found on the Internet:

  1. https://github.com/RoEdAl/alarm-uboot-sunxi-armv7
  2. https://uthings.uniud.it/building-mainline-u-boot-and-linux-kernel-for-orange-pi-boards
  3. https://archlinuxarm.org/platforms/armv7/allwinner/pcduino3

I have gone through all these steps recently and got a working board with my favorite Arch Linux ARM. I hope it will be helpful for someone else.

@moebiussurfing
moebiussurfing / ImGuiDockspaceExample.cpp
Created July 29, 2021 05:43 — forked from AidanSun05/ImGuiDockspaceExample.cpp
A modified DockSpace example for Dear ImGui. Changes are listed at the top of the file.
// CHANGES MADE:
// Added more clarifying comments inside the function.
// Removed MSVC warning C6011 - null pointer dereference.
// Fixed a slight grammar error - "This demo app only demonstrate" => "This demo app only demonstrates"
// Demonstrate using DockSpace() to create an explicit docking node within an existing window.
// Note: You can use most Docking facilities without calling any API. You DO NOT need to call DockSpace() to use Docking!
// - Drag from window title bar or their tab to dock/undock. Hold SHIFT to disable docking.
// - Drag from window menu button (upper-left button) to undock an entire node (all windows).
// About dockspaces:
@RafalJDev
RafalJDev / CountYoutubeVideosTime.js
Last active May 28, 2025 15:42
Count all videos time duration on youtube channel
//You need to run this in javascript console inside chrome (althought should work the same in other browsers)
//Assumptions:
//1. Will count only "expanded" videos on page, you may first need to run script to scroll to last video or do it manually
//2. Tested on chrome, ubuntu, 2019
//3. Time format: hh:mm:ss
var array = document.getElementsByClassName("style-scope ytd-thumbnail-overlay-time-status-renderer");
var arrLength = array.length;
@ddovod
ddovod / gist.cpp
Last active July 7, 2025 09:50
ImGui::TextAnsiColored
/*
MIT License
Copyright (c) 2024 David Dovodov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is