Skip to content

Instantly share code, notes, and snippets.

View carlosmgv02's full-sized avatar
💀
Coding

Carlos Martínez carlosmgv02

💀
Coding
View GitHub Profile
@carlosmgv02
carlosmgv02 / README-socket.md
Last active February 20, 2023 20:58
Socket program in c.

XDPrac1

Socket example developed in C, it creates a client and a server, and sends files in between.

FILES

  • client.c
  • client

Python youtube video downloader

This code consists of a python script which allows us to easily download YouTube videos/audio by passing its URL via the command line.
python_32x32

Content

Project files

  • youtube.py: the script's code
  • aux_functions: contains multiple functions used to customize the output color and animations.

Default output

By default, the script outputs the file to: D:\YouTube, you can simply change it by modifying the path variable.

@carlosmgv02
carlosmgv02 / README-pyXMLRPC.md
Last active February 20, 2023 20:59
Python XML-PRC

Python XML-RPC server

Simple XML-RPC server using python, communicates two local shells to performa a POST query and get the response on another shell.

@carlosmgv02
carlosmgv02 / README-service.md
Last active February 24, 2023 19:47
Custom service used to run own script when system boots

SysV custom service

Service starts when system boots and executes actualitzat.sh.
If the file /root/paquets exists, its content is passed by parameter to actualitzat.sh.

@carlosmgv02
carlosmgv02 / README-copia.md
Last active March 1, 2023 12:26
Servei systemD còpia de seguretat.

Laboratori systemD & sysV

Passos a seguir per a un correcte funcionament:

  1. Crear l'script de la còpia de seguretat en un directori com 'usr/local/bin/lab-administració.sh.
  2.  milax@casa:~$ sudo EDITOR=vim crontab -e
    1. Afegir la línia 0 10 * * 1-5 /bin/bash /usr/local/bin/lab-administracio.sh al fitxer. Aquest fitxer s'encarregarà de fer l'execució entre setmana.
    2. Guardar i sortir.
  3. Crear l'arxiu de servei de systemD en /etc/systemd/system/lab-administracio.service:
#!/bin/bash
# Author: Carlos Martínez García-Villarrubia (carlos.martinezg@estudiants.urv.cat)
date=$(date +"%Y-%m-%d %H:%M:%S")
if [ $# -gt 0 ]; then
for paquet in "$@"
do
# Comprovo si el paquet ja està instal·lat
if apt list --installed | grep -w "$paquet" >/dev/null 2>&1; then
@carlosmgv02
carlosmgv02 / acronyms_mac.py
Last active May 30, 2024 11:27
SD Exam preparation
import random
import sys
import tty
import termios
acronyms = [
"3PC: Three Phase Commit Protocol",
"ACID: Atomicity, Consistence, Isolation, Durability",
"ACL: Access control list",
"API: Aplication programing interface",