Skip to content

Instantly share code, notes, and snippets.

@joker-x
joker-x / gist:8b5de71067cd2ef06e62fe987e474a4c
Created May 17, 2023 08:03
OVH mirror Ubuntu 22.04 sources.list
# APT OVH mirrors
deb http://ubuntu.mirrors.ovh.net/ftp.ubuntu.com/ubuntu/ jammy main restricted
# deb-src http://ubuntu.mirrors.ovh.net/ftp.ubuntu.com/ubuntu/ jammy main restricted
deb http://ubuntu.mirrors.ovh.net/ftp.ubuntu.com/ubuntu/ jammy-updates main restricted
# deb-src http://ubuntu.mirrors.ovh.net/ftp.ubuntu.com/ubuntu/ jammy-updates main restricted
deb http://ubuntu.mirrors.ovh.net/ftp.ubuntu.com/ubuntu/ jammy universe
# deb-src http://ubuntu.mirrors.ovh.net/ftp.ubuntu.com/ubuntu/ jammy universe
deb http://ubuntu.mirrors.ovh.net/ftp.ubuntu.com/ubuntu/ jammy-updates universe
@joker-x
joker-x / install-jitsi-desktop.bash
Last active May 12, 2024 12:41
Install jitsi-desktop 2.10.5550-1 on Ubuntu 20.04, 21.10 or 22.04
#!/bin/bash
# Install jitsi-desktop 2.10.5550-1
# Tested on:
# - Ubuntu 20.04, 21.10 and 22.04
# - Elementary OS 6.1
# ----------------------------------------------------------
# Add missing dependencies and force to run with openjdk-8
[ "$(id -u)" -ne 0 ] && echo "This script must be run as root" && exit 1
@joker-x
joker-x / lxc-backup.sh
Last active December 20, 2017 11:50
Genera un tar.gz con el contenedor lxc listo para archivar o migrar. Recibe el nombre del contenedor como primer parámetro.
#!/bin/bash
DIR_BACKUP="/var/backups"
[[ "$1" == "" ]] && echo "Error en el número de argumentos" && exit 1
[[ -z $(lxc-ls | grep -w $1) ]] && echo "No existe el contenedor $1" && exit 1
[[ -z $(whereis pigz | tr -d 'pigz:') ]] && echo "Error: pigz no instalado" && exit 1
#echo "Existe el contenedor $1"
CONTENEDOR=$1
@joker-x
joker-x / mysqlbackup
Last active January 31, 2024 06:57
Vuelca todas las bases de datos separadas y comprimidas con gzip
#!/bin/bash
# Requiere tener configurado el acceso a MySQL en ~/.my.cnf
if [ ! -f ~/.my.cnf ]; then
echo "ERROR: No existe ~/.my.cnf"
exit 1
fi
# Para usar junto con rsnapshot los ficheros generados deben
# estar en el directorio actual. Por ello el valor de DESTINO
@joker-x
joker-x / genera_certificado_autofirmado.sh
Created April 17, 2014 00:06
Genera un certificado autofirmado
#!/bin/bash
#
# Genera un certificado autofirmado
#
# VARIABLES DE CONFIGURACIÓN
USUARIO="www-data:www-data"
DESTINO="/etc/nginx/ssl"
PASSWD="pass:pEpElEchEs"
DOMINIO=$1
@joker-x
joker-x / nginx-reload.sh
Created April 17, 2014 00:00
Recarga la configuración de nginx, pensado para que determinados usuarios puedan cambiar la configuración del servidor web y recargarla.
#!/bin/bash
# Recarga la configuración de nginx, pensado para que determinados usuarios
# puedan cambiar la configuración del servidor web y recargarla.
#
# Invocado /etc/sudoers.d/nombre-usuario
#
# Referencias:
# * https://github.com/rtCamp/nginx-helper/issues/9
# * http://www.cyberciti.biz/tips/allow-a-normal-user-to-run-commands-as-root.html
@joker-x
joker-x / debian_aeat.sh
Created April 16, 2014 23:46
Parche para hacer funcionar iceweasel en las gestiones de la AEAT
#!/bin/bash
# Cuando tratas de completar un trámite con Hacienda (AEAT)
# mediante un certificado digital correctamente instalado en iceweasel
# salta este error:
# es.gob.afirma.keystores.main.common.AOKeystoreAlternativeException
# Error message: Error al inicializar el almacen NSS unificado de
# Mozilla Firefox
@joker-x
joker-x / clonar_bd.sh
Created December 5, 2013 04:37
Clona la base de datos $1 con el nombre $2 en el mismo servidor sql sin utilizar mysqldump
#!/bin/bash
# Clona la base de datos $1 con el nombre $2
set -e
# Comprobaciones
[ $# -ne 2 ] && echo "ERROR: Número de argumentos" && exit 1
[ ! -f ~/.my.cnf ] && echo "ERROR: ~/.my.cnf no definido" && exit 1
[ "$1" == "$2" ] && echo "ERROR: No puedes clonar sobre ti mismo" && exit 1