This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
def mi_funcion(): | |
import inspect | |
print(f"Ahora me encuentro en la función {inspect.stack()[0][3]}") | |
print(f"He sido llamado por {inspect.stack()[1][3]}") | |
def funcion_intermedia(): | |
mi_funcion() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Si tenemos que hacer un programa que, pongamos por caso, recoletará información de varios | |
# orígens, que nos interesa guardar en CSV, como por ejemplo: | |
# * IP origen | |
# * fecha registro | |
# * hora del evento | |
# * evento | |
# | |
# Estaremos generando un fichero parecido a: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# Este script realiza una copia recursiva de todos los ficheros contenidos en un árbol de directorios, a un | |
# directorio plano. Para evitar coincidencia de nombres, se asigna un uuid como nombre del fichero en el | |
# destino. | |
# | |
# Se mantienen las fechas del original (usando copy2) lo que nos permitirá ordenar cronológicamente el resultado. | |
import os |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Este escript genera una entidad certificadora y un certificado | |
# para el servidor firmado por dicha entidad. | |
# Los *.key se corresponden con las claves privadas y, los *.crt, con las claves públicas. | |
# Definomos contraseña y datos del certificado | |
PASSWD="contraseñaParaCA" | |
SUBJCA='/C=ES/ST=Barcelona/O=organizacion/CN=CA.de.plena.confianza' | |
SUBJCERTS='/C=ES/ST=Barcelona/O=organizacion/CN=mi.dominio.net' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Este script crea un certificado autofirmado. | |
# Clave privada: fichero.key | |
# Clave pública: fichero.crt | |
DOMINIO=mi.servidor.net | |
DIASVALIDEZ=3650 | |
CLAVEPRIVADA=$DOMINIO.key | |
CLAVEPUBLICA=$DOMINIO.crt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
NC='\033[0m' | |
for modo in $(seq 0 1); do | |
for color in $(seq 30 37); do | |
# Color sin fondo (primera columna) | |
COLOR="\033[${modo};${color}m" | |
TEXTO=" ${modo};${color} " | |
printf "${COLOR}${TEXTO}${NC} " | |
for fondo in $(seq 40 47); do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# Bucle que genera todas las combinaciones de colores y fondos ansi | |
# e imprime una muestra por pantalla | |
# | |
# Estos códigos también se pueden utilizar desde scrips bash, | |
# RED='\033[0;31m' | |
# NC='\033[0m' | |
# echo "Se ha producido un ${RED}ERROR{NC} inesperado." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html lang="es"> | |
<head> | |
<title>✅ Drag & Drop Files 📌 </title> | |
<meta charset="UTF-8"/> | |
<style type="text/css"> | |
/* Importamos las fuentes "Work Sans" */ | |
@import url('https://fonts.googleapis.com/css?family=Work+Sans&display=swap'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# Ejemplo de publicación en flask de una gráfica generada siguiendo el | |
# mismo proceso que se seguiríamos para crearla en un jupyter notebook | |
# Paquetes requeridos | |
# sudo apt install python3-tk | |
# python3 -m venv venv | |
# source venv/bin/activate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ejemplo de publicación en flask de una gráfica generada siguiendo el | |
# mismo proceso que se seguiríamos para crearla en un jupyter notebook | |
# Paquetes requeridos | |
# sudo apt install python3-tk | |
# python3 -m venv venv | |
# source venv/bin/activate | |
# pip3 install matplotlib | |
# pip3 install pandas | |
# pip3 install numpy |
NewerOlder