Skip to content

Instantly share code, notes, and snippets.

View davisonio's full-sized avatar
🚀
Focusing

Craig Davison davisonio

🚀
Focusing
View GitHub Profile
@davisonio
davisonio / welcomeinfo.lua
Last active March 9, 2022 00:51
WelcomeInfo mod for Minetest, code should have been condensed at the time.
--------------------------------------------
--WelcomeInfo mod by CraigyDavi and crazyR--
--------------------------------------------
--TO DO
--Condense code and make it easier to edit the text using variables.
--Release as a mod.
--Revoke interact when frozen and grant when unfrozen.
--Anything else?
--Please note that at the moment this will not work using a mobile client! *I think*--
@davisonio
davisonio / get_player_ip.lua
Last active March 9, 2022 00:50
Get the IP of a player, Minetest command.
minetest.register_chatcommand("ip", {
params = "<name>",
description = "Show the IP of a player",
privs = {server = true},
func = function(name, param)
-- If no playername is specified you will get a help message
if param == "" then
minetest.chat_send_player(name, "Usage: /ip <playername>")
return
end
@davisonio
davisonio / random_mapgen.lua
Last active March 9, 2022 00:50
A random mapgen for minetest
local count = 0
local c_air = minetest.get_content_id("air")
local function count_nodes()
for i,_ in pairs(minetest.registered_nodes) do
count = count+1
end
end
minetest.register_on_generated(function(minp, maxp, seed)
local old_nodes = {"mod:block1", "mod:block2", "mod:block3"}
local old_entities = {"mod:item1", "mod:item2", "mod:item3"}
for _,node_name in ipairs(old_nodes) do
minetest.register_node(":"..node_name, {
groups = {old=1},
})
end
minetest.register_abm({
@davisonio
davisonio / timer.lua
Last active March 9, 2022 00:44
Timer mod for minetest
local player_hud = {}
local timer = 0
local function floormod (x, y)
return (math.floor(x)%y)
end
local function get_time()
local secs = (60*60*24*minetest.env:get_timeofday())
local mins = floormod(secs/60, 60)
@davisonio
davisonio / javafx-music-functions.java
Created January 12, 2018 16:44
JavaFX Music Functions
*/* CODE AT TOP OF CLASS SO THAT MEDIA PLAYER IS ACCESSIBLE EVERYWHERE */*
public static MediaPlayer songPlayer = null;
*/* CODE TO START PLAYING */*
File songFile = new File("Music/amazingsong.mp3"); // Music folder
should be in project root, not in 'src'
if (songFile.isFile()) {
@davisonio
davisonio / apache
Last active June 18, 2016 10:22
Prevent your web server (apache, nginx) from serving the /.git/ directory.
# Put this in your .htaccess file in the root of the website.
RedirectMatch 404 /\.git
@davisonio
davisonio / keybase.md
Created May 2, 2016 13:30
Keybase proof

Keybase proof

I hereby claim:

  • I am davisonio on github.
  • I am davisonio (https://keybase.io/davisonio) on keybase.
  • I have a public key whose fingerprint is F1D0 ACA4 6B5B 6B21 7613 201B 77C2 1102 FC13 06DF

To claim this, I am signing this object:

@davisonio
davisonio / letsencrypt-commands.txt
Last active February 5, 2016 19:00
Let's Encrypt commands - v0.2.0
usage:
letsencrypt [SUBCOMMAND] [options] [-d domain] [-d domain] ...
The Let's Encrypt agent can obtain and install HTTPS/TLS/SSL certificates. By
default, it will attempt to use a webserver both for obtaining and installing
the cert. Major SUBCOMMANDS are:
(default) run Obtain & install a cert in your current webserver
certonly Obtain cert, but do not install it (aka "auth")
install Install a previously obtained cert in a server
@davisonio
davisonio / minetestmapper.txt
Last active February 5, 2016 18:32
minetestmapper settings for Minetest
Small map:
./minetestmapper -i ~/Documents/Gaming/Minetest/minetest-servers/worlds/server/ -o ~/Documents/Gaming/Minetest/maps/map-small.png --backend sqlite3 --drawscale --drawalpha --geometry -1000:-1000+2000+2000
Big map:
./minetestmapper -i ~/Documents/Gaming/Minetest/minetest-servers/worlds/server/ -o ~/Documents/Gaming/Minetest/maps/map-big.png --backend sqlite3 --drawscale --drawalpha --geometry -10000:-10000+20000+20000