Skip to content

Instantly share code, notes, and snippets.

View gphg's full-sized avatar

Garett PHG gphg

  • NKRI
View GitHub Profile
@ybw0014
ybw0014 / compile-slimefun-addon-online.md
Last active June 9, 2024 19:27
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)

Introduction

Most open-source Slimefun addons are hosted on GitHub.

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

@oofnikj
oofnikj / answerfile
Last active July 6, 2024 14:23
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"
@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 March 11, 2024 18:59
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 June 28, 2024 12:58
Installing Xdebug for XAMPP
@Zulko
Zulko / makegifs.py
Last active December 27, 2022 18:16 — forked from luser/makegifs.py
Just indications on what you could do, @luser
#!/usr/bin/env python
# Taken from http://zulko.github.io/blog/2015/02/01/extracting-perfectly-looping-gifs-from-videos-with-python-and-moviepy/
import os
import sys
import moviepy.editor as mp
from moviepy.video.tools.cuts import FramesMatches
if len(sys.argv) != 2:
@tylerneylon
tylerneylon / copy.lua
Last active May 18, 2024 16:41
How to deep copy Lua values.
-- copy.lua
--
-- Lua functions of varying complexity to deep copy tables.
--
-- 1. The Problem.
--
-- Here's an example to see why deep copies are useful. Let's
-- say function f receives a table parameter t, and it wants to
@aroemen
aroemen / restore-git-submodules.sh
Created February 25, 2013 02:39
Restore git submodules from .gitmodules. Since git submodule init only considers submodules that already are in the index (i.e. "staged") for initialization this short script parses .gitmodules, and each url and path pair.
#!/bin/sh
set -e
git config -f .gitmodules --get-regexp '^submodule\..*\.path$' |
while read path_key path
do
url_key=$(echo $path_key | sed 's/\.path/.url/')
url=$(git config -f .gitmodules --get "$url_key")
git submodule add $url $path
@Deco
Deco / deepcopy.lua
Created October 31, 2012 05:38
Lua Non-recursive Deep-copy
--[[ deepcopy.lua
Deep-copy function for Lua - v0.2
==============================
- Does not overflow the stack.
- Maintains cyclic-references
- Copies metatables
- Maintains common upvalues between copied functions (for Lua 5.2 only)
TODO