Skip to content

Instantly share code, notes, and snippets.

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

Zoilo Mora zoilomora

🏠
Working from home
View GitHub Profile
@zoilomora
zoilomora / command_generator.php
Created October 14, 2018 19:13
Descargar canciones de la "Lista LOS40" - Los 40 Principales
<?php
$data = json_decode(file_get_contents('./data.json'));
$result = '';
foreach ($data->songs as $song) {
$ffmpegCommand = sprintf(
'ffmpeg -ss %s -t %s -i {} \"%s.mp3\" && rm {}',
$song->start,
$song->duration,

mdadm

Glossary:

  • md: multiple devices
command description
cat /proc/mdstat show status of all raids
mdadm --detail /dev/md0 detailed status of raid md0
@zoilomora
zoilomora / README.md
Last active April 25, 2024 08:17
How to disable systemd-resolved in Ubuntu

How to disable systemd-resolved in Ubuntu

Stages

  • Disable and stop the systemd-resolved service:

      sudo systemctl disable systemd-resolved.service
      sudo systemctl stop systemd-resolved
    
  • Then put the following line in the [main] section of your /etc/NetworkManager/NetworkManager.conf:

@zoilomora
zoilomora / README.md
Last active April 24, 2024 12:42
How to disable cloud-init in Ubuntu

How to disable cloud-init in Ubuntu

Prevent start

  • Create an empty file to prevent the service from starting

      sudo touch /etc/cloud/cloud-init.disabled
    

Uninstall

@zoilomora
zoilomora / README.md
Last active May 28, 2023 17:22
Configure Forwarded DNS in MikroTik

Configure Forwarded DNS in MikroTik

Stages

My house MikroTik runs a permanent tunnel to the offices of my job. DHCP configures the devices to send DNS requests to MikroTik, which then sends the requests to Google or forwards them to the DNS server of my job.

Job intranet = intranet.job.local
Job DNS Server = 192.168.90.1
@zoilomora
zoilomora / loop.sh
Created March 30, 2020 08:52
Script to execution loop with output if it fails
#!/bin/sh
set -e
while true
do
eval "$@"
done
@zoilomora
zoilomora / failover.rst
Last active February 5, 2021 08:32
Failover with MikroTik

# ------------------- header -------------------# Base script created by # Script by Tomas Kirnak, version 1.0.7 # If you use this script, or edit and # re-use it, please keep the header intact. # # For more information and details about # this script please visit the wiki page at # http://wiki.mikrotik.com/wiki/Failover_Scripting

@zoilomora
zoilomora / Run commands in Windows 10 from Linux.md
Created March 30, 2021 20:31
Run commands in Windows 10 from Linux

Run commands in Windows 10 from Linux

In many cases, it can be very useful to send a command to a Windows from Linux. In my case, I was given this need when trying to shutdown a computer remotely via command line and then integrate said command into Node-RED.

Take these simple steps and you can get them done quickly.

Install OpenSSH natively on Windows 10 with PowerShell

Follow the instructions given by Microsoft for the installation and configuration of the service: OpenSSH Install FirstUse.

@zoilomora
zoilomora / Temperature and Voltage from MikroTik Router by Telegraf.md
Last active April 18, 2024 23:39
Temperature and Voltage from MikroTik Router by Telegraf

Temperature and Voltage from MikroTik Router by Telegraf

Telegraf is a highly modular software provided by InfluxData that allows us to configure numerous Inputs and Outputs to collect any information.

In this case I have done the tests with my MikroTik hEX S router.

Mikrotik provides you with a MIB file with the OID addresses of its Routers.

Configure Telegraf

Create a file in /etc/telegraf/telegraf.d/ with extension .conf with the following content:

@zoilomora
zoilomora / Flash TREEYE WiFi Smart Plug with Tasmota.md
Last active October 24, 2023 20:00
Flash TREEYE WiFi Smart Plug with Tasmota

Flash TREEYE WiFi Smart Plug with Tasmota

How did I get here?

I saw a very good offer for a Wi-Fi Smart Plugs with an Energy Monitoring and I couldn't resist.

The plug was of the [TREEYE] brand (I had not heard it in my life) but I saw that they were [TUYA] and I said to myself... they sure are compatible with [tuya-convert]. ERROR!

I was surprised that [tuya-convert] didn't work and decided to open it for manual flashing. Oh My God! They didn't have an [ESP8266] but a [WB2S module]!