Skip to content

Instantly share code, notes, and snippets.

View hluaces's full-sized avatar

Héctor Luaces hluaces

View GitHub Profile
@hluaces
hluaces / output.txt
Created October 1, 2020 10:25
Bug blockinfile in ansible 2.10 output
ansible-playbook 2.10.1
config file = None
configured module search path = ['/home/hector/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/hector/.local/lib/python3.8/site-packages/ansible
executable location = /home/hector/.local/bin/ansible-playbook
python version = 3.8.2 (default, Jul 16 2020, 14:00:26) [GCC 9.3.0]
No config file found; using defaults
setting up inventory plugins
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
@hluaces
hluaces / lvm-cache-fedora.md
Created September 30, 2020 14:05 — forked from gabrieljcs/lvm-cache-fedora.md
Instructions to create an LVM cache for root in Fedora

LVM cache in Fedora

From the man-pages: "The cache logical volume type uses a small and fast LV to improve the performance of a large and slow LV. It does this by storing the frequently used blocks on the faster LV. LVM refers to the small fast LV as a cache pool LV. The large slow LV is called the origin LV. Due to requirements from dm-cache (the kernel driver), LVM further splits the cache pool LV into two devices - the cache data LV and cache metadata LV. The cache data LV is where copies of data blocks are kept from the origin LV to increase speed. The cache metadata LV holds the accounting information that specifies where data blocks are stored (e.g. on the origin LV or on the cache data LV). Users should be familiar with these LVs if they wish to create the best and most robust cached logical volumes. All of these associated LVs must be in the same VG."

Assuming LVM is already setup in HDD (e.g. from anaconda) and SSD is untouched.

Create a physical

@hluaces
hluaces / README.md
Created June 1, 2020 18:38
Mis prácticas de la UNED

En este gist guardo enlaces a los repositorios en los que comparto mis soluciones a todas las prácticas de la UNED que he ido realizando durante mi curso lectivo, en aras de que a alguien le sirvan de algo, pues cuando yo me metí en esto no tenía por donde tirar.

@hluaces
hluaces / loops.md
Created February 6, 2020 09:08
List of ISP feedback looops

This list was originally present the wiki for this mailserver repository wiki page. I've created a gist with it as it is something that can be useful per se and I'd like to keep a copy of it.

A Feedback Loop (FBL) is a system by which an Internet Service Provider provides the sender a copy of the message that one of their subscribers has reported as spam — usually by hitting a “report spam” button in that ISP’s mail interface.

ISPs offer feedback loops to qualified senders, so the senders can identify subscribers who no longer want to receive similar mail and/or any problems originating from their networks, such as virus-infected spam-producing machines.

This page summarizes the information about FBL signup pages, whitelist pages, and postmaster pages of most popular ISPs around the world.

| ISP | FBL Signup | Whitelist Signup | Postmaster Page | ----- | -------------- | ----------------

@hluaces
hluaces / .htaccess
Created January 13, 2020 14:01
Example usage of mod_expires on an .htaccess file to change the browser cache
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/css A31536000
ExpiresByType text/x-component A31536000
ExpiresByType application/x-javascript A31536000
ExpiresByType application/javascript A31536000
ExpiresByType text/javascript A31536000
ExpiresByType text/x-js A31536000
ExpiresByType text/html A3600
ExpiresByType text/richtext A3600
@hluaces
hluaces / ejemplo.php
Last active September 23, 2019 07:19
Filtro que añade a las búsquedas de WordPress tanto entradas como páginas
function filtro_mostrar_entradas_y_posts($query) {
if ($query->is_search) {
$query->set('post_type', ['post', 'page']);
}
return $query;
}
add_filter('pre_get_posts','filtro_mostrar_entradas_y_posts');
---
- name: 'Example playbook to populate a dinamically created list list'
hosts: localhost
vars:
# The list of known VPNs
vpn_list:
- 'vpn-1'
- 'vpn-2'
- 'vpn-3'
@hluaces
hluaces / zabbixv4_remove_acks.sql
Created June 11, 2019 11:35
Remove Acknowledges from Zabbix v4
-- Héctor Luaces Novo
-- SQL query to remove ACKs from Zabbix events.
-- It is name-based but it can be easily tweaked to filter in some other ways.
-- Please note that this might cause damage to your database. Be sure to have a backup.
-- Usage:
-- Copy this in an editor, change the NAME_PATTERN to switch your needs.
-- If everything ran successfully, commit the transaction. Otherwise, do a rollback
-- The pattern for your mail triggers
@hluaces
hluaces / phpcgi-watcher.sh
Last active February 20, 2019 15:21 — forked from josesayago/phpcgi-watcher.sh
PHP-CGI Watcher, a little BASH script to kill PHP-CGI orphan processes draining server resources.
#!/bin/bash
#
# @author Jose SAYAGO
# @uri http://josesayago.com/blog/
#
# Process to monitor how many PHP-CGI processes are running, and kill them
# if they exceed the limit
#
# Set the maximum number of CGI Processes allowed
MAX_CGI=25;
@hluaces
hluaces / functions.php
Last active February 12, 2019 11:13
Snippet para crear avatares aleatorios desde un array en WordPress. Creado para adjuntar a una respuesta de un blog. El código puede añadirse a un plugin personalizado o a un fichero "functions.php". Una vez creado aparecerá la nueva opción dentro de "Ajustes → Discusión".
<?php
/**
* Snippet para avatares de WordPress aleatorios en base a un array de
* imágenes.
*
* Se asume que éstas están en ./wp-content/uploads/avatares/.
*
* Este código puede añadirse a un "functions.php" o a cualquier plugin
* personalizado.