Author: chirale

Get number of files or directory using tree

Leave a comment
System Administration

Tree is an useful linux command to display a tree representation a full directory structure or a part of it. On a Debian based distro like Ubuntu install: The last line of tree print a line like this: 346 directories, 174 files If you’re changing files and directories and you want a real-time update of files and directories number, you can use watch. Tree will print the tree, tail will extract the last line, then […]

Nginx configuration for Django

Leave a comment
Howtos / System Administration

Django is a powerful framework for building websites. To run a production website, usually an application server is used. So nginx will do two basic things: Serve your Django application from the application server port to the web port (Reverse Proxy) Serve static and media files The application server used in this example is gunicorn, the application server chosen by Instagram of the earlier days, but it can be anything running on port 9999. Change […]

nginx: [emerg] open() “/usr/share/nginx/off” failed (13: Permission denied) [SOLVED]

Leave a comment
Howtos / System Administration

After a failed restart of the nginx server, you can get this error typing journalctl -xe: nginx: [emerg] open() “/usr/share/nginx/off” failed (13: Permission denied) [SOLVED] This is caused by a misconfiguration of nginx.conf or a conf inside the /etc/nginx/conf.d/ directory where there’s something like: This is the wrong way to disable logs. Nginx is actually trying to write a file called off inside the default folder. The right way To disable error_log simply do not […]

Use external mail server for mdadm

Leave a comment
Howtos / System Administration

mdadm is the utility to check and report failures on RAID disks. The usual way this Linux application send its message is a plain old e-mail. In this howto you’ll find the instruction to use an external mail server with mdadm. First, replace sendmail with an external email account. After you’ve configured and tested msmtp you’re ready to configure mdadm. Configure mdadm with the new SMTP Change /etc/mdadm/mdadm.conf to Where: senderaddress@example.com is your FROM e-mail, […]

Use external SMTP server for system mails on Linux

Leave a comment
Howtos / System Administration

To use an external SMTP for all system e-mails, you have to install these: Where msmtp-mta transform the external reference in the sendmail command usable by any application using sendmail. In this way you haven’t to install and configure Postfix since you’ll rely on an external SMTP service. Create the config file for msmtp This is an example based on the popular Gmail by Google: Replace these with the real data from your e-mail account. […]

Automate log cleanup for GDPR: the Sentry case

Leave a comment
Howtos / System Administration

With the General Data Protection Regulation (GDPR) enforced by European Union logs have to be cleaned regularly to delete IP addresses and other information about visitors. This can be interpreted as a way to protect an emerging and discussed right, the right to be forgotten. This new regulation is impacting every automated log system out of there. Since Sentry is a good open source error monitoring software* and it’s widely used, this guide will show […]

Cannot connect to wired connection on Ubuntu (SOLVED)

Leave a comment
Howtos / System Administration

When your Wireless interface is working and the ethernet isn’t working on Ubuntu, here’s a quick howto to check and fix a misconfiguration. It doesn’t solve any ethernet issues but you can give a try and on an Asus laptop (with JMicron chipset) I worked on it makes the job done. Tested on Ubuntu 16.04 LTS First steps To detect Ethernet interface: To check and configure connection: To save the current status of network interface: […]

Delete git files from public GitHub history

Leave a comment
Coding / Howtos

To delete git files uploaded accidentally to GitHub (or any other public repository) do these steps: Download https://rtyley.github.io/bfg-repo-cleaner/ as suggested by GitHub git clone –mirror GIT_REPOSITORY_URL cd path/to/cloned/repository Download BFG java -jar /path/to/download/dir/bfg-VERSION.jar –delete-files filename.ext Run the command specified by BFG (usually git reflog expire –expire=now –all && git gc –prune=now –aggressive) git push If you get an error on pull, probably you haven’t cloned the repository as step 2. Browsing the public history, any […]

Mass delete old email on Gmail preserving Special and Tagged ones

Leave a comment
Howtos

To mass delete old emails on Gmail type this search query in the search box of mail.google.com (or Gmail for Business): after:2017/01/01 before:2017/31/12 -has:userlabels -is:starred You can use these filters in any language but remember to use the YYYY/DD/MM format for the data (Year/Day/Month) for the after and before filters. This search will show you all emails between January, 1st and December, 31st 2017 that: Haven’t any User Label Aren’t starred (without Star) Change dates […]