Skip to content

Instantly share code, notes, and snippets.

View ojgarciab's full-sized avatar
👨‍👩‍👧‍👦
Busy for family reasons

Óscar García ojgarciab

👨‍👩‍👧‍👦
Busy for family reasons
View GitHub Profile
@ojgarciab
ojgarciab / LEEME.md
Last active March 8, 2025 16:22
Copia de archivos en Linux con progreso y cálculo de tiempo estimado preciso

Con esta función añadida al archivo ~/.bashrc conseguiremos hacer una copia de archivos con un cálculo de tiempo estimado muy preciso (mucho más que el de Nautiluls u otras herramientas) debido a que cada 1 MiB se forzará la confirmación de datos en el sistema de archivos de destino:

cpx() {
    if [ $# -lt 2 ]; then
        echo "Uso: cpx <archivo_origen> <archivo_destino>"
        return 1
    fi

pv "$1" | dd of="$2" bs=1M conv=fsync

@ojgarciab
ojgarciab / index.html
Created December 18, 2024 08:04
HTML5 y Bootstrap 5.3.3
<!doctype html>
<html lang="es">
<head>
<!-- Meta tags requeridos -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Recursos de Bootstrap -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
<title>Título de ejemplo</title>
@ojgarciab
ojgarciab / correccion.sh
Created May 14, 2024 07:10
Buscar guiones que no finalizan correctamente con una nueva línea y corregirlos
find . -iname "*.sh" \
| while read -r archivo
do
FINAL=$(tail -c 1 "$archivo" | hexdump -ve '1/1 "%.2x"')
[ "$FINAL" != "0a" ] && echo >> "$archivo"
done
@ojgarciab
ojgarciab / README.md
Created April 24, 2024 06:48
Activar la búsqueda del historial con las teclas Re Pág (page down) y Av Pág (page up)

En el archivo /etc/inputrc aparecen estas líneas comentadas:

# alternate mappings for "page up" and "page down" to search the history
# "\e[5~": history-search-backward
# "\e[6~": history-search-forward

Para descomentarlas basta con teclear:

sed -i -re 's/^# ?(.*: ?history-search-.*)$/\1/g' /etc/inputrc
@ojgarciab
ojgarciab / install-docker.sh
Created September 15, 2023 12:28 — forked from p3jitnath/install-docker.sh
Docker and Nvidia Docker installation in Ubuntu 20.04 LTS
# WARNING : This gist in the current form is a collection of command examples. Please exercise caution where mentioned.
# Docker
sudo apt-get update
sudo apt-get remove docker docker-engine docker.io
sudo apt install docker.io
sudo systemctl start docker
sudo systemctl enable docker
docker --version
@ojgarciab
ojgarciab / README.md
Created September 7, 2023 12:35
Secuencia para superar puzle del nivel de Guardian Tales
  • Abajo
  • Izquierda
  • Arriba
  • Arriba
  • Derecha
  • Diagonal arriba/izquierda
@ojgarciab
ojgarciab / Código.ps1
Created June 16, 2023 12:25
Crear y usar copias "shadow" para acceder a archivos en uso
# Documentación:
# https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/aa394428(v=vs.85)
# Creamos la copia
$shadow = (Get-WmiObject -List Win32_ShadowCopy).Create("C:\\", "ClientAccessible")
$shadow2 = Get-WmiObject Win32_ShadowCopy | Where-Object { $_.ID -eq $shadow.ShadowID }
$dispositivo = $shadow2.DeviceObject + "\\"
cmd /c mklink /d C:\shadowcopy "$dispositivo"
# Acceso a los datos desde C:\shadowcopy
@ojgarciab
ojgarciab / autologin.conf
Last active June 15, 2023 14:53
Debian 11 text mode autologin
# /etc/systemd/system/[email protected]/autologin.conf
# Tested on Debian 11
[Service]
ExecStart=
# Replace 'user' with the username of your choice to enable automatic login
ExecStart=-/sbin/agetty --noclear --autologin user %I $TERM
[
{
"id": 1,
"video": "video1.mp4",
"img": "imagen1.jpg",
"url": "pruebas1"
},
{
"id": 2,
"video": "video2.mp4",