Skip to content

Instantly share code, notes, and snippets.

View xarmengol's full-sized avatar

Xavier Armengol xarmengol

  • Barcelona
View GitHub Profile
@xarmengol
xarmengol / 20201021-xarmengol-moving-folders-older-than.md
Last active February 1, 2022 15:08
Moving files older than 1 year

Moving folders older than one year from current location, to destination folder:

find . -maxdepth 1 -mtime +365 -exec sudo mv {} /mnt/DestinationFolder/ \;

  • -maxdepth 1 option is to only check folders age at first level
  • -mtime +365 to list files or folder older than or equal to 365 days old
@xarmengol
xarmengol / InstruccionesInstalacionZStickGen5HomeAssistant.md
Last active April 20, 2020 18:36
Instalación de Aeotec Z-Stick Gen5 para Home Assistant, en un Hassio instalado en una Raspberry Pi 3
  1. Conectamos nuestro Z-Stick
  2. Vemos en qué puerto se ha conectado, haciendo un dmesg desde el terminal de Hassio:

Captura de Pantalla 2020-04-20 a les 19 56 10

En nuestro caso, vemos que se ha asignado el nombre ttyACM0. Por lo que el path al dispositivo será /dev/ttyACM0

  1. Añadimos el dispositivo en nuestro configuration.yaml:
@xarmengol
xarmengol / InstruccionesInstalacionZStickGen5HomeAssistant.md
Created April 20, 2020 18:29
Instalación de Aeotec Z-Stick Gen5 en Hassio
  1. Conectamos nuestro Z-Stick
  2. Vemos en qué puerto se ha conectado:

En nuestro caso, vemos que es al path ttyACM0 3.Añadimos el dispositivo en nuestro configuration.yaml:

#Z-Wave
zwave:
 usb_path: /dev/ttyACM0
@xarmengol
xarmengol / 20200403-xarmengol-increase_disk_partition_centos8.md
Last active April 17, 2023 13:51
How to increase partition disk on vmware CentOS 8

Steps to increase the disk for a vmware centos 8 server

1. Increase the virtual machine disk by using vCenter

Increase the disk space of the machine, using vCenter. If there is any existing snapshot, this could not be done. So any existing snapshot have to be deleted previously.

Not sure if needed, but once the disk space is increased, reboot the machine.

2. Create a new partition disk by using fdisk

@xarmengol
xarmengol / API.md
Created April 23, 2018 14:08 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@xarmengol
xarmengol / SetLocale.md
Last active February 6, 2024 01:46
Set locale for authenticated users in laravel

Intro

What we want to do is to set the locales of a laravel 5.6 application, by depending of the language of the authenticated user. We store the language preferences of a user on the database, in the users table.

Steps

Create a new Middleware:

php artisan make:middleware AuthUserSetLocale
@xarmengol
xarmengol / gist:992ae843113818cb4a343f91bb38c4a8
Created February 19, 2017 11:00
Moving a git bare repository to a new server
// 1. Creation of a new bare and shared repository
git init --bare --shared repo.git
// 2. Moving code from old repo to new one
// 2.1. Locally clone of the old repo
git clone user@10.10.10.10:/opt/git/repo.git
// 2.2. Web add a new remote repo origin to the new cloned local repo:
git remote add neworigin newuser@20.20.20.20:/opt/git/repo.git