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
View GitHub Profile
@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:

@paulozullu
paulozullu / certbot.md
Last active March 8, 2019 13:31
Let's Encrypt certbot (HTTPS)

Step 1 — Installing Certbot

The first step to using Let's Encrypt to obtain an SSL certificate is to install the Certbot software on your server.

Certbot is in very active development, so the Certbot packages provided by Ubuntu tend to be outdated. However, the Certbot developers maintain a Ubuntu software repository with up-to-date versions, so we'll use that repository instead.

First, add the repository.

$ sudo add-apt-repository ppa:certbot/certbot
@paulozullu
paulozullu / javascript_tips.md
Last active April 25, 2019 13:57
jquery and javascript tips

1 - Convert string to Date (dd/mm/aaaa)

var from = $("#datepicker").val().split("-");
var f = new Date(from[2], from[1] - 1, from[0]);

2 - Convert now date to Date

var time = Date.now();
var date = new Date(time);
@paulozullu
paulozullu / tips.MD
Last active November 14, 2019 12:27
MI A2 tips

Update Havoc OS

- boot twrp
- flash update 
- wipe cache and dalvik 
- flash twrp installer
- wipe cache and dalvik 
- change slot
- reboot recovery
- install GAPPS
@paulozullu
paulozullu / foundation.MD
Last active October 24, 2018 18:35
Foundation tips

1 - Error on opening an reveal modal throwing (We're sorry, 'open' is not an available method for this element.)

var popup = new Foundation.Reveal($('#myElement'));
popup.open();
@paulozullu
paulozullu / clean-up-boot-partition-ubuntu.md
Created August 28, 2018 02:23 — forked from ipbastola/clean-up-boot-partition-ubuntu.md
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@paulozullu
paulozullu / compact.js
Created August 13, 2018 16:41 — forked from BlakeGardner/compact.js
Compact all collections inside of a MongoDB database
// This script loops though the list of collection names in a MongoDB and runs the compact operation on them
// Simply paste this into the Mongo shell
use testDbName;
db.getCollectionNames().forEach(function (collectionName) {
print('Compacting: ' + collectionName);
db.runCommand({ compact: collectionName });
});
@paulozullu
paulozullu / linux_tips.MD
Last active May 7, 2022 11:16
Linux tips

Fixes and tips for Linux

1 - Headset mic not recognized

$ sudo nano /etc/modprobe.d/alsa-base.conf

Add bottom:

options snd-hda-intel model=laptop-dmic

Save and reboot

@paulozullu
paulozullu / libreoffice_calc.MD
Last active June 8, 2025 03:59
Libre Office Calc Tips

Convert UNIX timestamp to date in LibreOffice Calc

As it seems, OpenOffice's "day 0" is December 12th, 1899; that implies that January 1st, 1970 is day 25569 for OpenOffice. Now, if you divide a UNIX timestamp by 86400 (the number of seconds in a normal day), that will give you the number of days between the epoch and that timestamp (and some decimal, that you can use to calculate the time of day). And if you sum that number with 25569, you have an OpenOffice day for that timestamp.

Alright, let's put all the pieces together: let's say cell A2 contains a UNIX timestamp 1341104400, then this formula

=A2/86400+25569

will return a number. And if you format that cell as a date, DD/MM/YYYY HH:MM:SS, then you'll read a pretty "01/07/2012 01:00:00" there.