Skip to content

Instantly share code, notes, and snippets.

View ewized's full-sized avatar

ewized

View GitHub Profile
const red = (text) => ({ color: '31', text })
const green = (text) => ({ color: '32', text })
const white = (text) => ({ color: '0', text })
const color = (strings, ...args) => {
const colorize = args.map(({ color, text }) => `\x1b[${color}m${text}`)
return strings.reduce((acc, item) => `${acc}${item}${colorize.shift() ?? ''}`, '')
}
console.log(color`${red`FAIL`} ${white`foobar`} ${green`pass`}`)
@ewized
ewized / statusping.py
Last active January 26, 2024 02:18
Python3 class to ping a Minecraft server and get its response including ping in ms
#!/usr/bin/python3
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
@ewized
ewized / Web Portal
Last active January 17, 2023 06:22
Simple web portal with HTML5, CSS3, and Javascript.
<!DOCTYPE html>
<html>
<head>
<title>Portal Site</title>
<meta name="description" content="Portal Site not Portal"/>
<meta name="keywords" content="Minecraft"/>
<link href='http://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'>
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<style type="text/css" rel="stylesheet">
body {
@ewized
ewized / wrapper.py
Last active February 14, 2022 12:10
A watchdog for Minecraft servers to make sure they are running all the time, even in the event of a crash.
#!/usr/local/bin/python3
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
@ewized
ewized / Circles.groovy
Last active February 3, 2022 02:28
Parametric equations for circles
import net.year4000.ducktape.bukkit.DuckTape
import net.year4000.ducktape.bukkit.module.BukkitModule
import net.year4000.ducktape.bukkit.module.ModuleListeners
import net.year4000.ducktape.module.ModuleInfo
import org.bukkit.Bukkit
import org.bukkit.event.player.PlayerInteractEvent
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
import org.bukkit.Material
@ewized
ewized / cors-anywhere-import.js
Last active December 1, 2019 15:22
Script that will install base_elements from the latest release version
'use strict'
// Import the script from the url
function importScript(url) {
const request = new XMLHttpRequest()
request.onload = () => eval(request.responseText)
request.open('GET', url, true)
request.send()
}
<!DOCTYPE html>
<html>
<head>
<style>
.dot {
position: absolute;
height: 10px;
width: 10px;
display: block;
background: #000;
@ewized
ewized / fix_id_conflict.sql
Last active February 8, 2018 01:41
Postgres Bug Fix ID Conflict
-- What we did to fix this bug,
-- https://hcmc.uvic.ca/blogs/index.php?blog=22&p=8105&more=1&c=1&tb=1&pb=1
--SELECT MAX(id) FROM pilot;
--SELECT nextval('public.pilot_id_seq');
--SELECT pg_get_serial_sequence('pilot', 'id')
--SELECT nextval('public.pilot_id_seq');
--SELECT setval('public.pilot_id_seq', 13833);
<settings>
<profiles>
<profile>
<id>projectares</id>
<repositories>
<repository>
<id>freundtech</id>
<name>freundTech</name>
<url>https://repo.freundTech.com</url>
</repository>
@ewized
ewized / links.txt
Created September 26, 2016 03:41
Pictures from Addons/Plugin panel