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/sh | |
# Author: David Creus | |
# Programa que automatitza la creació d'usuaris en un entorn OpenLDAP | |
################################################################# | |
#Verifiquem que el usuari que executa l'script es root # | |
################################################################# | |
if [ "$(id -u)" != "0" ]; then | |
echo "Tens que ser root per executar aquest script" 1>&2 | |
exit 1 | |
fi |
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 | |
if [ $# -ne 1 ]; then | |
echo "Número de argumentos no validos, sólo se permite 1" | |
exit 1 | |
fi | |
if [ -f $1 ] && [ -n $1 ]; then | |
echo -e "Todo OK" |
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 | |
mysqldump --databases db1 > "/$USER/mysql-backup/db1-$(date +'%Y-%m-%d').sql" | |
mysqldump --databases db2 > "/$USER/mysql-backup/db2-$(date +'%Y-%m-%d').sql" | |
mysqldump --databases db3 > "/$USER/mysql-backup/db3-$(date +'%Y-%m-%d').sql |
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
#Comprovar número de paràmetres | |
#Mirar si una web està online | |
if [ $# -ne 1 ]; then | |
echo "Número de argumentos no validos, sólo se permite 1" | |
exit 1 | |
fi | |
WEB=$1 | |
code=`curl -s -I $1 | head -n 1 | cut -d ' ' -f2` |
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 | |
while read LINE; do | |
curl -o /dev/null --silent --progress-bar --head --write-out '%{http_code} %{time_starttransfer} %{url_effective}\n' "$LINE" | |
done < websites.lst | |
echo -e "\n" | |
echo -e "Code 200: Okei" | |
echo -e "Code 302: Okei (http)" | |
echo -e "Code 404: Not found" |
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
CONTADOR=1 | |
let MINUMERO=$(( $RANDOM %6 + 1)) #Numero aleatori del 1 al 6 | |
echo ' '; echo 'Numero Aleatorio entre 1 y 6' | |
echo '***************************************************' | |
read -p "Digam el teu nom: " NOMBRE | |
echo '***************************************************' | |
echo ' ' ; echo ' ' | |
read -p "Portes $CONTADOR intents. Digam un número: " NUMERO | |
# | |
until [ $NUMERO -eq $MINUMERO ]; 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
#Programa que comprueba si los hosts estan disponibles (mediante ping) | |
date | |
cat /home/davidcrx/list.txt | while read output | |
do | |
ping -c 1 "$output" > /dev/null | |
if [ $? -eq 0 ]; then | |
echo "node $output is up" | |
#dialog --msgbox "Todo correcto" 10 20 | |
else | |
echo "node $output is down" |
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
!Router R2 configuration | |
enable | |
conf t | |
interface serial 0/0/1 | |
ip address 192.168.101.1 255.255.255.0 | |
no shutdown | |
end | |
conf t | |
ip dhcp excluded-address 192.168.102.1 192.168.102.3 |
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
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Drawing; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; | |
using System.Net.Mail; |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace ReadFile | |
{ | |
class Program | |
{ |