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 / 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 April 3, 2018 20:36
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.

@paulozullu
paulozullu / python_tips.MD
Last active April 16, 2021 12:19
Python and Django tips

1 - Check if an element exists in a list of dictionnaires

my_list = [
    {'main_color': 'red', 'second_color':'blue'},
    {'main_color': 'yellow', 'second_color':'green'},
    {'main_color': 'yellow', 'second_color':'blue'},
]

if not any(my_dict['main_color'] == 'red' for my_dict in my_list):
    # does not exist
@paulozullu
paulozullu / virtualenv_python3.rst
Last active February 16, 2018 17:32
Install virtualenvwrapper

Create a virtualenv with Python3:

$ mkvirtualenv -p python3 envname