Update httpserv command with Python3

This commit is contained in:
Jeremy Gardais 2023-01-27 10:49:23 +01:00
parent e62370ffe8
commit 9ec904304a
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
2 changed files with 146 additions and 5 deletions

132
history.bak Normal file
View File

@ -0,0 +1,132 @@
: 1633622894:0;cd
: 1633622895:2;mr update
: 1633622909:0;tiday
: 1633622913:0;t
: 1633622921:0;tase
: 1633632972:0;ta
: 1633632977:0;ssh home.gardouille.fr
: 1633632989:0;host home.gardouille.fr
: 1633632992:0;cd .ssh
: 1633632995:0;vi 01.gardouille.conf
: 1633633332:0;ggstatus
: 1633635651:0;ANS_HOST="vmreverse" ; ANS_DOMAIN="101010.virtual" ; DEBOPS_REPO="101010"
: 1633635655:0;debops service/pki -l "${ANS_HOST:=/dev/null}"
: 1633637410:0;host home.gardouille.fr
: 1633638841:0;ssh home.gardouille.fr
: 1633638845:0;clearsshkey 449
: 1633638847:0;ssh home.gardouille.fr
: 1633638960:0;ggpull
: 1633638971:0;vi alerts.cfg.j2
: 1633639044:0;ANS_HOST="vmmonitoring" ; ANSIBLE_CONFIG="~/repos/101010.debops/ansible.cfg" ansible-playbook ~/repos/101010.debops/ansible/playbooks/101010.xymon.server.yml -l "${ANS_HOST:=/dev/null}" -t role::xymon_server
: 1633639470:0;ggstatus
: 1633639473:0;ggdiff analysis.cfg.j2
: 1633639476:0;ggadd analysis.cfg.j2
: 1633639477:0;ggco
: 1633679146:0;ta
: 1633679148:0;ggstatus
: 1633679151:0;gglg
: 1633679152:0;ggpush
: 1633679177:0;ggpush
: 1633679200:0;v
: 1633679755:0;vi analysis.cfg.j2
: 1633679765:0;vi client-local.cfg.j2
: 1633679788:0;ANSIBLE_CONFIG="~/repos/ipr.debops/ansible.cfg" ansible-playbook ~/repos/ipr.debops/ansible/playbooks/ipr.xymon.server.yml -l "${ANS_HOST:=/dev/null}" -t role::xymon_server
: 1633679800:0;ANSIBLE_CONFIG="~/repos/ipr.debops/ansible.cfg" ansible-playbook ~/repos/ipr.debops/ansible/playbooks/ipr.post.debops.yml -l "${ANS_HOST:=/dev/null}" -t role::xymon_server
: 1633679834:0;ANSIBLE_CONFIG="~/repos/ipr.debops/ansible.cfg" ansible-playbook ~/repos/ipr.debops/ansible/playbooks/ipr.xymon.server.yml -l "${ANS_HOST:=/dev/null}" -t role::xymon_server
: 1633679843:0;ANS_HOST="monitoring.ipr" ; ANSIBLE_CONFIG="~/repos/ipr.debops/ansible.cfg" ansible-playbook ~/repos/ipr.debops/ansible/playbooks/ipr.xymon.server.yml -l "${ANS_HOST:=/dev/null}" -t role::xymon_server
: 1633679885:0;u
: 1633679888:0;cd inventory/host_vars
: 1633679889:0;vi peach.yml
: 1633679933:0;ggdiff .
: 1633679935:0;ggstatus
: 1633679938:0;ggdiff donkey.yml peach.yml
: 1633679941:0;ggadd donkey.yml peach.yml
: 1633679942:0;ggco
: 1633680111:0;u
: 1633680116:0;vi group_vars/gardouille_phys/apt_install.yml
: 1633680164:0;ggrep apt_install__group_packages
: 1633680170:0;ggstatus
: 1633680176:0;ggadd group_vars/gardouille_phys/apt_install.yml
: 1633680179:0;ggadd group_vars/gardouille_rpi/apt_install.yml
: 1633680181:0;cd host_vars
: 1633680182:0;vi peach.yml
: 1633680192:0;ggadd peach.yml
: 1633680202:0;ggdiff donkey.yml
: 1633680204:0;ggadd donkey.yml
: 1633680205:0;ggstatus
: 1633680207:0;ggco
: 1633680220:0;ggpush
: 1633680521:0;ggstatus
: 1633680524:0;ggdiff analysis.cfg.j2
: 1633680534:0;ggadd analysis.cfg.j2
: 1633680535:0;ggstatus
: 1633680537:0;ggdiff hosts.d/ipr.licence.cfg.j2
: 1633680556:0;vi hosts.d/ipr.licence.cfg.j2
: 1633680636:0;ggstatus
: 1633685369:0;vi analysis.cfg.j2
: 1633685443:0;ANS_HOST="monitoring.ipr" ; ANSIBLE_CONFIG="~/repos/ipr.debops/ansible.cfg" ansible-playbook ~/repos/ipr.debops/ansible/playbooks/ipr.xymon.server.yml -l "${ANS_HOST:=/dev/null}" -t role::xymon_server
: 1633685860:0;vi analysis.cfg.j2
: 1633686949:0;vi analysis.cfg.j2
: 1633688047:0;ggstatus
: 1633688052:0;ggstatus
: 1633688055:0;ggdiff hosts.d/ipr.kvm.cfg.j2
: 1633688059:0;ggadd hosts.d/ipr.kvm.cfg.j2
: 1633688060:0;ggco
: 1633688208:0;vi analysis.cfg.j2
: 1633688280:0;ANS_HOST="monitoring.ipr" ; ANSIBLE_CONFIG="~/repos/ipr.debops/ansible.cfg" ansible-playbook ~/repos/ipr.debops/ansible/playbooks/ipr.xymon.server.yml -l "${ANS_HOST:=/dev/null}" -t role::xymon_server
: 1633694239:0;ggstatus
: 1633694242:0;ggdiff analysis.cfg.j2
: 1633694244:0;ggadd analysis.cfg.j2
: 1633694248:0;vi analysis.cfg.j2
: 1633694318:0;ggdiff analysis.cfg.j2
: 1633694320:0;ggadd analysis.cfg.j2
: 1633694321:0;ggco
: 1633694342:0;vi analysis.cfg.j2
: 1633694346:0;ggamend
: 1633694450:0;ggstatus
: 1633694453:0;ggdiff analysis.cfg.j2
: 1633694458:0;ANS_HOST="vmmonitoring" ; ANSIBLE_CONFIG="~/repos/101010.debops/ansible.cfg" ansible-playbook ~/repos/101010.debops/ansible/playbooks/101010.xymon.server.yml -l "${ANS_HOST:=/dev/null}" -t role::xymon_server
: 1633694769:0;ggstatus
: 1633694771:0;ggdiff analysis.cfg.j2
: 1633694772:0;ggadd analysis.cfg.j2
: 1633694773:0;ggco
: 1633694778:0;gglg
: 1633694795:0;ggstatus
: 1633694798:0;ggpush
: 1633695109:0;ggstatus
: 1633695111:0;ggstatus
: 1633695153:0;ggstatus
: 1633695162:0;cd -5
: 1633695170:0;find . -iname "cups"
: 1633695180:0;cd templates/by-group/ipr_users/etc/cups
: 1633695181:0;ll
: 1633695183:0;ll ppd
: 1633695198:0;cd -
: 1633695203:0;cd ./templates/by-group/ipr_users_nano/etc/cups
: 1633695203:0;ll
: 1633695206:0;vi printers.conf
: 1633695221:0;vi mr076109.spm.yml
: 1633695720:0;ggstatus
: 1633695722:0;vi mr076109.spm.yml
: 1633695754:0;ANS_HOST="mr076109.spm"
: 1633695761:0;debops service/nfs -l "${ANS_HOST:=/dev/null}"
: 1633696074:0;vi mr076109.spm.yml
: 1633696219:0;vi fury.yml
: 1633696323:0;debops service/mount -l "${ANS_HOST:=/dev/null}"
: 1633696371:0;vi mr076109.spm.yml
: 1633696387:0;debops service/mount -l "${ANS_HOST:=/dev/null}"
: 1633697041:0;path
: 1633697044:0;ll
: 1633697047:0;path
: 1633697909:0;ggstatus
: 1633697912:0;ggadd mr076109.spm.yml
: 1633697912:0;ggco
: 1633697925:0;ggstatus
: 1633697927:0;ggpush
: 1633697931:0;aful
: 1633697937:0;ggstatus
: 1633758492:0;ta
: 1633758502:0;cd repos/101010.debops
: 1633758509:0;cd repos/ipr.debops
: 1633758517:0;ssh physix102.ipr.univ-rennes1.fr
: 1633758509:0;cd repos/ipr.debops

19
zshrc
View File

@ -321,8 +321,9 @@ alias md='mkdir'
alias rd='rmdir'
#Internet
## Créer un mini serveur web à partir du dossier courant (http://localhost:8002)
alias httpserv='python -m SimpleHTTPServer'
## Minimal webserver from current directory and available at http://IP.AD.RE.SS:8002
## See : https://docs.python.org/3/library/http.server.html
alias httpserv='python3 -m http.server -b $(hostname -i) 8002'
## Créer un mini serveur web à partir du quel les utilisateurs peuvent uploader des fichiers sur la machine
alias httpup="python /home/${USER}/bin/droopy -m \"Salut, c'est Bob l'éponge, envoi moi un fichier stp.\" -p /home/${USER}/avatar.png -d /media/data/download"
@ -1201,7 +1202,7 @@ function listalias(){
}
#Récupère l'adresse IP publique
# Get public IP address {{{
function ippub()
{
#curl ifconfig.me
@ -1209,9 +1210,9 @@ function ippub()
#wget http://checkip.dyndns.org/ -O - -o /dev/null | cut -d" " -f 6 | cut -d\< -f 1
dig +short myip.opendns.com @resolver1.opendns.com
}
# }}}
#Récupère l'adresse IP (privee)
# Get all private IP addresses {{{
function ippriv()
{
for interface in $(find /sys/class/net/ ! -name lo -type l -printf "%f\n" | sort);
@ -1220,6 +1221,14 @@ function ippriv()
printf '%b' "${WHITEB}${interface}${RESET}: ${IP_INTER}\n"
done
}
# }}}
# Get main private IP adress {{{
function ipmain()
{
hostname -i
}
# }}}
# Test if a network connection is available
function is_network()