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 / tiles.md
Last active May 18, 2023 09:34
Hextraction new tiles

Hextraction new tiles

All electric tiles can only be connected when they are placed. They cannot be disconnected unless destroyed.

T1 Electric - Wind farm

Generates low voltage power, has a single outgoing XT connector for supplying a nearby tile with power.

Effect: When placed, turn on the tile.

@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='[email protected]'
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)
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
class Scratch {
public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
TestClass testClass = new TestClass();
long time = System.currentTimeMillis();
for (int i = 0; i < 10000000; i++) {
import java.io.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
public class Main {
public static final int MAX_PER_LINE = 6;
public static final String FILE_IN = "C:\\Users\\denia\\Desktop\\val temps int.csv";
@hugo4715
hugo4715 / main.py
Created November 2, 2019 10:20
sin matplotlib
import random
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
ax1 = fig.add_subplot(111)
increment = 0.01
@hugo4715
hugo4715 / main.py
Created November 1, 2019 14:57
sin
import pygame
from pygame.locals import *
import math
import random
ROUGE = (255, 0, 0)
BLANC = (255, 255, 255)
VERT = (0, 255, 0)
pygame.init()
@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