Skip to content

Instantly share code, notes, and snippets.

View hugo4715's full-sized avatar
😁
Always coding

hugo4715

😁
Always coding
View GitHub Profile
@hugo4715
hugo4715 / upgrade-pg.py
Created March 12, 2024 12:31 — forked from wvengen/upgrade-pg.py
Major upgrade PostgreSQL on cloudnative-pg
#!/usr/bin/env python3
#
# Helper script to do major version upgrades of a cloudnative-pg based
# PostgreSQL cluster.
#
# Usage: python3 upgrade-pg.py <cluster-name> <new-pg-version>
#
# Example: python3 upgrade-pg.py my-backend-db 16.0
#
# Make sure to include major and minor version in the pg version.
@hugo4715
hugo4715 / cloudflare_ddns.sh
Created February 25, 2023 09:30 — forked from mjhirst/cloudflare_ddns.sh
Use Cloudflare's API to set Dynamic DNS records with Crontab
#!/bin/sh
# Cloudflare API v.4 Variables
CF_APIKEY='Your API Key Here'
CF_ZONEID='The Zone ID here' # Found on your Cloudflare Dashboard
CF_DNSID='The DNS ID here' # Found by listing DNS with Cloudflare API, see below for command
CF_EMAIL='your@email.address'
CF_DNS='address.domain.com'
GET_IP=$(dig +short txt ch whoami.cloudflare @1.0.0.1)
@hugo4715
hugo4715 / swagger-yaml-to-html.py
Created December 18, 2020 13:25 — forked from oseiskar/swagger-yaml-to-html.py
Converts Swagger YAML to a static HTML document (needs: pip install PyYAML)
#!/usr/bin/python
#
# Copyright 2017 Otto Seiskari
# Licensed under the Apache License, Version 2.0.
# See http://www.apache.org/licenses/LICENSE-2.0 for the full text.
#
# This file is based on
# https://github.com/swagger-api/swagger-ui/blob/4f1772f6544699bc748299bd65f7ae2112777abc/dist/index.html
# (Copyright 2017 SmartBear Software, Licensed under Apache 2.0)
#
@hugo4715
hugo4715 / big-o-java-collections.md
Created November 17, 2020 12:39 — forked from FedericoPonzi/big-o-java-collections.md
Big O notation for java's collections

The book Java Generics and Collections has this information (pages: 188, 211, 222, 240).

List implementations:

                      get  add  contains next remove(0) iterator.remove
ArrayList             O(1) O(1) O(n)     O(1) O(n)      O(n)
LinkedList O(n) O(1) O(n) O(1) O(1) O(1)
@hugo4715
hugo4715 / DCPU-16Spec.txt
Created October 7, 2018 10:41 — forked from metaphox/DCPU-16Spec.txt
DCPU-16 Specification
DCPU-16 Specification
Copyright 1985 Mojang
Version 1.7
=== SUMMARY ====================================================================
* 16 bit words
* 0x10000 words of ram
@hugo4715
hugo4715 / Metrics.java
Created February 7, 2017 12:37 — forked from Bastian/Metrics.java
The Metrics class for bStats (Bungeecord)
package your.package;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import net.md_5.bungee.api.plugin.Plugin;
import net.md_5.bungee.api.scheduler.TaskScheduler;
import net.md_5.bungee.config.Configuration;
import net.md_5.bungee.config.ConfigurationProvider;
import net.md_5.bungee.config.YamlConfiguration;
@hugo4715
hugo4715 / pom.xml
Created December 28, 2016 19:01 — forked from Pocketkid2/pom.xml
pom.xml template for Bukkit/Spigot plugins
<!-- My pom.xml's usually look like this and I don't like retyping stuff -->
<!-- If any of these are not filled out you should -->
<groupId>CHANGE ME - PACKAGE IDENTIFIER</groupId>
<artifactId>CHANGE ME - PROJECT PACKAGE IDENTIFIER</artifactId>
<version>CHANGE ME - EVERY VERSION</version>
<name>CHANGE ME - NO SPACES RECOMMENDED</name>
<description>CHANGE ME - ONE SENTENCE DESCRIPTION RECOMMENDED</description>
<properties>
1/2 Ores - For every 2 ores you mine, 1 drops. Every single ore is seperate from one and another.
3x Arrows - When you shoot with your bow, not one, but three arrows get shot out.
Monsters Inc - If you place a door on the map, go through it and there's 2 or more doors on the map, you will be teleported to one of those doors.
AppleFamine - Apples do not drop from trees.
Armor v Health - For every half Armor Point you add to your Armor bar, half a Health Point will be taken away from your Health. Any health lost to armor will not be healed back.
Backpacks - Players have extra inventory space(the backpack), that they can access using a command. When a player dies the "backpack" drops as a chest.
Bald_Chicken - Chickens do not drop feathers on death, instead, skeletons drop an amount between 4 and 8 arrows on death.
Barebones - The Nether is disabled, and iron is the highest tier you can obtain through gearing up. When a player dies, they will drop 1 diamond, 1 golden apple, 32 arrows, and 2 string. You cannot c
@hugo4715
hugo4715 / ExtensionFileFilter.java
Created September 3, 2016 17:06 — forked from tomoyamkung/ExtensionFileFilter.java
[Java]FilenameFilter を使ったフィルタクラス。
package net.tomoyamkung;
import java.io.File;
import java.io.FilenameFilter;
/**
* 指定した拡張子と一致するファイルを取得するフィルタクラス。
*
* @author tomoyamkung
*
package fr.finalsword.api.scoreboards;
import net.minecraft.server.v1_8_R2.*;
import org.apache.commons.lang.Validate;
import org.bukkit.ChatColor;
import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer;
import org.bukkit.entity.Player;
import java.lang.reflect.Field;