Skip to content

Instantly share code, notes, and snippets.

View coliveiraeti's full-sized avatar
🇧🇷

Carlos Oliveira coliveiraeti

🇧🇷
View GitHub Profile
@coliveiraeti
coliveiraeti / README.md
Created October 25, 2020 13:50
Find device for an external drive and mount it

The thing is, I use an external drive attached to my Linux laptop and every time I plug it in, it ends up assigned to a different device (e.g. /dev/sda, /dev/sdd...).

Yeah! I know I can address that by using fstab/UUID but I wanted to take this as an opportunity to improve my bash scripting skills.

Here is the script I've created. It uses jq so make sure it is installed on your machine and change the config variables as you please.

@coliveiraeti
coliveiraeti / Flatten.js
Created August 31, 2018 04:14
Flatten array
if (!Array.prototype.flatten) {
Array.prototype.flatten = function() {
var result = [];
this.forEach(function(i) {
if (Array.isArray(i)) {
i.flatten().map(function(j) {
this.push(j);
}, this);
}
else {
@coliveiraeti
coliveiraeti / port6010.md
Created December 5, 2017 21:09
Disabling port 6010 on Ubuntu 16.04

Introduction

When I finally finished setting up a new VPS for my side projects, I realized this unknown (at least for me) open port: 6010.

Open Ports

It took me a quick search on Google to find out it was related to the X11 Forwarding feature present on SSH. If you don't need this feature in your server, disabling it is actually very simple.

Solution

Edit your SSH server configuration file: