Skip to content

Instantly share code, notes, and snippets.

View gphg's full-sized avatar

Garett PHG gphg

  • NKRI
  • 16:38 (UTC +07:00)
View GitHub Profile
@ybw0014
ybw0014 / compile-slimefun-addon-online.md
Last active May 13, 2025 18:06
How to compile a Slimefun addon on GitHub

This guide introduces how you compile a Slimefun addon on GitHub, without the need to install anything extra on your computer.

You will need to have:

  • A modern browser.
  • A good internet connection.
  • A GitHub account (click here to sign up if you don't have one yet)
  • Reading comprehension.

Introduction

@Mrfiregem
Mrfiregem / meme-text.sh
Last active January 28, 2025 16:04
A bash script to add meme text to a video file using ffmpeg
#!/usr/bin/env bash
# Initialize variables to customize output
: "${FFILE:="${HOME}/.fonts/i/impact.ttf"}" # Let user choose font file
: "${FSIZE:=72}" # Let user choose font size in px
: "${BSIZE:=5}" # Let user choose stroke size in px
: "${OFFSET:='(h*0.05)'}" # Let user choose text offset in px
# TTEXT - Text to display at the top of the image
# BTEXT - Text to display at the bottom of the image
# Exit value index:

A metatable can be defined like

local t = setmetatable({}, {
  __tostring = function() return 'custom tostring behavior!' end
})

Here are the metamethods that you can define, and their behavior

Operators

@odan
odan / nginx-php-windows-setup.md
Last active May 31, 2025 19:30
Nginx and PHP Setup on Windows

Nginx and PHP Setup on Windows

For local development you could also use Nginx with PHP as an replacement for XAMPP.

Install Nginx

@oofnikj
oofnikj / answerfile
Last active June 1, 2025 03:07
Install Docker on Termux
KEYMAPOPTS="us us"
HOSTNAMEOPTS="-n alpine"
INTERFACESOPTS="auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
hostname alpine
"
TIMEZONEOPTS="-z UTC"
@mattdesl
mattdesl / rgb-cmyk.glsl
Last active January 21, 2025 19:10
RGB / CMYK conversion in GLSL
// From the book: Graphics Shaders
vec3 CMYKtoRGB (vec4 cmyk) {
float c = cmyk.x;
float m = cmyk.y;
float y = cmyk.z;
float k = cmyk.w;
float invK = 1.0 - k;
float r = 1.0 - min(1.0, c * invK + k);
@heolin
heolin / event_manager.py
Created November 21, 2019 15:19
Simple event manager in python
class Mom:
def on_door_opened(self):
print("Who's there?")
class Priest:
def on_door_opened(self):
print("Is it police? Run!")
@troyane
troyane / mp42gif.sh
Last active May 22, 2024 17:20
See script and documentation here: https://github.com/troyane/StackOverflow-pro/tree/master/mp42gif Script to convert MP4 file to GIF (via ffmpeg). It creates intermediate custom color palette out of input video file and use it for resulting GIF for better picture quality. For more info see https://superuser.com/a/556031
#!/bin/bash
#
# Script to convert MP4 video to GIF with generation of custom color palette.
#
#=== Do not touch code below
# Inner variables
input_file=""
input_fps="20"
input_height="512"
@tim545
tim545 / lg-jquery-app-struct.md
Last active April 1, 2025 02:54
Structuring a large jQuery application

Structuring a large jQuery application

This document assumes you are building a traditional backend-heavy application as opposed to a frontend-heavy appliction which would typically use a framework like Angular or React. The use of these frameworks make this document irrelevant, however also require a change to your application architecture and a much larger overhead in order to get content onto a page, so as a simple way to build interactive web content a simple jquery based js stack will do fine.

Directory structure

It's important you use a directory structure which is impartial to your development environment, chosen server language (Python v. Java v. C# ...), and styling framwork (Twitter Bootstrap etc). This layer of separation means you can swap out the styles or the backend with minimal changes to the Js, simple and maintainable.

Here's an example from the project root:

@odan
odan / xampp_php7_xdebug.md
Last active April 9, 2025 13:07
Installing Xdebug for XAMPP