Skip to content

Instantly share code, notes, and snippets.

View robson-koji's full-sized avatar

Robson Koji Moriya robson-koji

View GitHub Profile
@robson-koji
robson-koji / dp_flyweight.md
Last active July 11, 2023 20:48
Design Pattern - Flyweight

Flyweight

The Flyweight design pattern is a structural design pattern that focuses on optimizing memory usage by sharing data between multiple objects. It is useful when you need to create a large number of similar objects that share common properties.

The main idea behind the Flyweight pattern is to separate the intrinsic (shared) and extrinsic (unique) parts of an object. The intrinsic part is immutable and can be shared among multiple objects, while the extrinsic part varies and is stored externally.

A basic example

@robson-koji
robson-koji / dp_bulider.md
Created June 26, 2023 20:11
Design Pattern - Builder

Builder

The builder pattern can be used for constructing complex objects with many configurable options.

The benefit of the Builder Pattern is that it allows for the creation of complex objects step by step, providing a clear and flexible way to configure and construct objects with varying attributes and options.

class Pizza:
    def __init__(self):
@robson-koji
robson-koji / dp_factory.md
Last active June 26, 2023 19:46
Design Pattern - Factory

Factory

This is a simplified example to demonstrate the Factory Pattern concept. In practice, you may have more complex creation logic and configurations in the factory, but the core idea remains the same: creating objects based on specific criteria or configurations.

class DataProcessor:
    def process(self):
        raise NotImplementedError()
@robson-koji
robson-koji / votingsystemnew.md
Last active June 14, 2023 12:57
Modeling, development, test and simulation

A Brand New Voting System

As for the problem and the suggestion presented in the my previous gist Voting System Schema Model Analysis, this is the first version for the new Voting System.

Modeling

This is a self contained Django application with all the logic and behavior encapsulated in the models layer.

VoteResults

For simple election based on the rules

@robson-koji
robson-koji / votingsystem.md
Last active June 26, 2023 14:13
Voting System Schema Model Analysis

Voting System Schema Model Analysis

This is an overview of the relationship between the main entities of the annotation process of the system and a analysis of the voting system used in WildePod - wildlife research project https://wildepod.org.

Objective

The analysis provided here was initially motivated by the need to establish a common understanding of the data flow within the annotation system and the voting system of WildePod.

Furthermore, the analysis aims to provide an understanding of the customized voting system used in WildePod and compare it to a traditional voting system.

It also seeks to identify specific improvements to the system in order to address bottlenecks in the annotation process and improve access to the internal data of the system.

@robson-koji
robson-koji / PLpgSQL.md
Last active June 14, 2023 14:11
PL/SQL - PL/PgSQL

PL/pgSQL

PL/pgSQL is a loadable procedural language for the Postgres database system.

ETL

Extract Transform Load

We can create an entire ETL process in PL/pgSQL to handle data stored in our databases. It is the fastest and most reliable way to do this. It's fast because we don't have to move data from the DB engine, and considering that all related tables are indexed, we only have to write and run the code in the engine to retrieve the information. Even during the transformation and loading process, the engine handles pointers and indices very efficiently.

Since we are working with data inside the database, we can perform operations with large datasets without any issues regarding data transfer (network) and memory usage. Instead of making atomic transactions, we can perform large set operations with large datasets. To do this, we will use SQL Functions.

@robson-koji
robson-koji / MyJobHunting.md
Last active June 27, 2023 20:27
My Job Hunting

My Job Hunting

About Me

I am a highly committed and skilled professional with a strong track record of solving complex software engineering problems efficiently.

I like to complete simpler tasks fast, and focus on delivering high-quality solutions and attention to detail ensures that I am always able to meet project deadlines and exceed expectations.

My ability to tackle challenging problems and deliver results quickly makes me an invaluable asset to any team.

@robson-koji
robson-koji / play-google-cloud-platform.md
Last active April 19, 2023 13:37
play-google-cloud-platform.md

Play Google Cloud Platform (GCP)

Google Cloud provides a vast array of managed services for computing, databases, NoSQL, and more. While these services offer numerous benefits, it's essential to weigh the tradeoff between cost and advantages.

Managed services are often the better choice as they ensure data security and eliminate the need for additional configuration and maintenance.

But using Google Compute Engine (GCE) to run cronjobs can provide a more cost-effective solution than Google App Engine (GAE) and enable more powerful hardware to process complex tasks in a unmanaged service.

To set up cronjobs on GCE, a well-defined process can be followed, which is documented below.

Cronjob in Google Compute Engine (GCE)

docker-postgres-ssl

Just a readme to remember how to install docker-postgres with SSL enabled

Create a Docker instance of Postgres with SSL enabled

This is the original post https://stackoverflow.com/a/55072885.

Some people share the information without the source. If you have any question, go there, it is well explainde.