Skip to content

Instantly share code, notes, and snippets.

View gnat's full-sized avatar
:shipit:
ez pz lemon squeezy

Nathaniel Sabanski gnat

:shipit:
ez pz lemon squeezy
View GitHub Profile
@ahhajlou
ahhajlou / fans-control.sh
Last active September 26, 2024 04:20
Linux_on_Asus_Laptop
# https://askubuntu.com/questions/1254364/how-to-control-fans-on-an-asus-laptop/1398098#1398098
cat << EOF >>~/.bashrc
alias fan-turbo='cd /sys/devices/platform/asus-nb-wmi; sudo sh -c "echo 1 >> fan_boost_mode"; sudo sh -c "echo 1 >> throttle_thermal_policy"; source ~/.bashrc; cd ~;'
alias fan-performance='cd /sys/devices/platform/asus-nb-wmi; sudo sh -c "echo 0 >> fan_boost_mode"; sudo sh -c "echo 0 >> throttle_thermal_policy"; source ~/.bashrc; cd ~;'
alias fan-silent='cd /sys/devices/platform/asus-nb-wmi; sudo sh -c "echo 2 >> fan_boost_mode"; sudo sh -c "echo 2 >> throttle_thermal_policy"; source ~/.bashrc; cd ~;'
EOF
source ~/.bashrc
@brablc
brablc / diogenesjs.html
Last active December 19, 2024 14:35
Diogenes JS
<script>
function $debug(...args) {
console.log('debug', ...args);
}
function $on(eventName, callback) {
document.currentScript.parentElement.addEventListener(eventName, callback);
}
function $send(element, name, detail) {
let event = new CustomEvent(name, { detail: detail, bubbles: true });
element?.dispatchEvent(event);
@brablc
brablc / benchmark-htmx-js-libraries.py
Last active September 8, 2024 15:40
Browser performance benchmark for htmx compatible JS libraries (alpine, surreal, hyperscript, htmx)
import argparse
import os
import requests
from abc import ABC, abstractmethod
parser = argparse.ArgumentParser(
description="""
Generates testing files for JS libraries that are popular with htmx.
Run --setup first to download libraries for local use.
A separate file for each library will be generated - timing is done with console.time and console.timeEnd.
@adtac
adtac / Dockerfile
Last active November 1, 2024 03:05
#!/usr/bin/env docker run
#!/usr/bin/env -S bash -c "docker run -p 8080:8080 -it --rm \$(docker build --progress plain -f \$0 . 2>&1 | tee /dev/stderr | grep -oP 'sha256:[0-9a-f]*')"
# syntax = docker/dockerfile:1.4.0
FROM node:20
WORKDIR /root
RUN npm install sqlite3
@nggit
nggit / eventloop.php
Last active January 14, 2024 21:18
A simple event loop with Fibers (PHP 8 >= 8.1.0)
<?php
// a simple event loop with Fibers (PHP 8 >= 8.1.0)
// in a style slightly inspired by Python's asyncio
// this will not immediately increase the throughput of your code
// since the functions are still executed sequentially in the event loop
// unless you can combine it with a non-blocking stream/socket
// to create the impression of io parallelism
@passivestar
passivestar / Editor.tres
Last active October 23, 2024 19:30
Godot editor theme
[gd_resource type="Theme" load_steps=12 format=3 uid="uid://7bvxnk5n5imx"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6h42l"]
content_margin_left = 10.5
content_margin_top = 8.75
content_margin_right = 10.5
content_margin_bottom = 8.75
bg_color = Color(0.117647, 0.117647, 0.117647, 1)
draw_center = false
border_color = Color(1, 1, 1, 0.137255)

During the past days, this great article by Sam Pruden has been making the rounds around the gamedev community. While the article provides an in-depth analysis, its a bit easy to miss the point and exert the wrong conclusions from it. As such, and in many cases, users unfamiliar with Godot internals have used it points such as following:

  • Godot C# support is inefficient
  • Godot API and binding system is designed around GDScript
  • Godot is not production ready

In this brief article, I will shed a bit more light about how the Godot binding system works and some detail on the Godot

@gnat
gnat / project_layout.md
Last active November 18, 2024 01:01
General Project Layout

Why a base project layout?

  • ⭐ Works for many different project types: game, website, app.
  • ⭐ Main files are up 1 level: lets us have supporting files excluded from Caddy, Godot, etc with zero extra config!
  • ⭐ Avoids industry jargon.

The intention is to be simple and universal; but feel free to use ideas you like, leave ideas you dislike.

Project Layout

@alexbezhan
alexbezhan / laser.js
Created February 26, 2023 23:47
Laser.js - fast and small HTMX-like library
/**
* Principles:
* 1. Performance
* 2. Simplicity and debuggability.
*
* It's not trying to be:
* 1. Flexible.
*
* This results into the following:
* 1. Explicit attributes only
@gnat
gnat / trello_discord.md
Last active April 6, 2023 20:54
Trello notification to Discord webhook using trigger (NO zapier or bs)

NO ZAPIER!

Select Board

➡️ Automation

➡️ Rules

➡️ Create Rule