Skip to content

Instantly share code, notes, and snippets.

View paulozullu's full-sized avatar
🏠
Working from home

Paulo Fabrício paulozullu

🏠
Working from home
  • Salvador, Bahia, Brazil
View GitHub Profile
@paulozullu
paulozullu / rebase.MD
Last active April 10, 2024 11:54
Git tips

O git rebase é usado para modificar o histórico de commits de uma branch. Ele reorganiza os commits de forma linear, movendo os commits da sua branch atual para o topo da branch de destino. Isso pode ser útil para integrar as mudanças de uma branch para outra de forma mais limpa, reorganizando e simplificando o histórico de commits.

Aqui está um exemplo básico de como usar o git rebase:

  1. Certifique-se de estar na branch que deseja modificar (por exemplo, feature):

    git checkout feature
  2. Atualize sua branch feature com as últimas mudanças da branch de destino (main, por exemplo):

@paulozullu
paulozullu / tips.MD
Created March 4, 2022 11:30
mySQL / phpAdmin

1 - Fix error on importing database

Error message: 3750 Unable to create or change a table without a primary key, when the system variable 'sql_require_primary_key' is set. Add a primary key to the table or unset this variable to avoid this message.

SET @ORIG_SQL_REQUIRE_PRIMARY_KEY = @@SQL_REQUIRE_PRIMARY_KEY;
SET SQL_REQUIRE_PRIMARY_KEY = 0;
@paulozullu
paulozullu / nodeJS.MD
Last active December 7, 2022 01:54
Node.js tips

1 - Default timezone in whole NestJS app

Date.prototype.toJSON = () => {
    return moment(this)
      .tz('America/Sao_Paulo')
      .format('YYYY-MM-DD HH:mm:ss.SSS');
  };

2- Install RabbitMQ locally with docker

@paulozullu
paulozullu / exception-filter.ts
Created November 4, 2021 14:05
NestJS Exceptions Filter
import {
ArgumentsHost,
Catch,
ExceptionFilter,
HttpException,
HttpStatus,
Logger,
} from '@nestjs/common';
@Catch()
const sts = new AWS.STS();
sts.getCallerIdentity({}, function (err, data) {
if (err) {
console.log('Error', err);
} else {
console.log(JSON.stringify({ data }));
}
});
@paulozullu
paulozullu / Fix.MD
Last active August 15, 2023 20:50
DigitalOcean without internet

After almost two weeks since I raised this issue, I was finally able to resolve it. The problem occurred in the first place because different packages got uninstalled somehow when I rebooted. This includes cloud-init, ufw and landscape-common. There is probably more that I haven’t noticed yet. Let’s start with the internet connection, this is how I fixed it:

  • Step 1. I created file “/etc/udev/rules.d/70-persistent-net.rules” and added
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="b2:fe:09:35:6e:57", NAME="eth0"

as I mentioned previously. Note that MAC address used above can be found here: “/etc/netplan/50-cloud-init.yaml”

  • Step 2. Run “sudo reboot” and check that eth0 interface persists by running “ifconfig -a”
@paulozullu
paulozullu / translate.html
Created September 10, 2020 11:55
Google translate
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>
How To Add Google Translate
Button On Your Webpage ?
</title>
</head>
@paulozullu
paulozullu / geos_error.md
Created March 20, 2020 16:00
Teknoloxica

Edit this file: site-packages/django/contrib/gis/geos/libgeos.py Look for the function: geos_version_info And change this line:

ver = geos_version().decode()

With this line:

ver = geos_version().decode().split(' ')[0]
@paulozullu
paulozullu / linux_swap_file.md
Last active July 17, 2019 12:21
How to create swap file.

Step 1 -- Checking the System for Swap Information

Before we begin, we can check if the system already has some swap space available. It is possible to have multiple swap files or swap partitions, but generally one should be enough.

We can see if the system has any configured swap by typing:

sudo swapon --show
@paulozullu
paulozullu / neo4j_delete_duplicate_nodes.md
Created April 12, 2019 12:37 — forked from jruts/neo4j_delete_duplicate_nodes.md
How to delete duplicate nodes and their relationships in neo4j with cypher?

How to delete duplicate nodes and their relationships in neo4j with cypher based on a property of that node?

The problem is easy to understand. We have 'duplicate' nodes in our database based on the 'id' field on the node properties.

Well this sounds easy enough, until you have to actually do it.

First step

My first attempt was to try and figure out which nodes are actualy duplicate (based on a property on the node). This seems to be pretty straightforward.

Cypher: