Outils pour utilisateurs

Outils du site


blog

Voir document

  • import_vm_vdi_qcow2.odt FIXME

Import VM (VDI QCOW2)

VDI vers RAW

$ VBoxManage clonehd --format RAW /home/jibe/tmp/wheezy1.vdi /home/jibe/tmp/wheezy1.img

VBoxManage: error: Cannot register the hard disk '/home/jibe/tmp/wheezy1.vdi' {16d89855-060b-4abf-a154-32b869784a26} because a hard disk '/home/jibe/VirtualBox VMs/wheezy1/wheezy1.vdi' with UUID {16d89855-060b-4abf-a154-32b869784a26} already exists
VBoxManage: error: Details: code NS_ERROR_INVALID_ARG (0x80070057), component VirtualBox, interface IVirtualBox, callee nsISupports
VBoxManage: error: Context: "OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, enmAccessMode, fForceNewUuidOnOpen, pMedium.asOutParam())" at line 178 of file VBoxManageDisk.cpp

Cette erreur disparaît en root

$ time VBoxManage clonehd --format RAW /home/jibe/tmp/wheezy1.vdi /home/jibe/tmp/wheezy1.img

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'RAW'. UUID: 8e3b2b88-31d2-4e60-8792-f42d4e7e107e

real	2m59.942s
user	0m1.272s
sys	0m1.084s

Le format RAW de gérant pas le <lang en>Copy-On-Write</lang> l'image générée sera de la taille maximal (Taille virtuelle)

$ ls -lh ~/tmp/wheezy1.*
-rw------- 1 root root 8,0G avril  1 11:38 /home/jibe/tmp/wheezy1.img
-rw------- 1 jibe jibe 1,6G mars   7 14:54 /home/jibe/tmp/wheezy1.vdi

Conversion RAW vers QCOW2

$ time qemu-img convert -f raw ~/tmp/wheezy1.img -O qcow2 wheezy1.qcow2
real	2m17.464s
user	0m5.684s
sys	0m26.528s

La taille de l'image disque redevient celle de l'espace vraiment consommé:

$ ls -lh wheezy1.qcow2
-rw-r--r-- 1 jibe jibe 1,5G avril  1 12:06 wheezy1.qcow2

Conversion OVA / OVF

Un OVA est une archive TAR

tar xvf plop.ova

Lister les formats pris en charge

qemu-img -h | tail -n1

Conversion du VMDK en QCOW2

qemu-img convert -O qcow2 plop-disk1.vmdk plop.qcow2

info sur l'image

qemu-img  info --output json plop.qcow2

Création d'un VMDK

wget https://download.fedoraproject.org/pub/fedora/linux/releases/31/Cloud/x86_64/images/Fedora-Cloud-Base-31-1.9.x86_64.raw.xz
xz --decompress Fedora-Cloud-Base-31-1.9.x86_64.raw.xz
qemu-img convert -f raw -O vmdk -o adapter_type=lsilogic,subformat=streamOptimized Fedora-Cloud-Base-31-1.9.x86_64.raw Fedora-31.vmdk
printf '\x03' | dd conv=notrunc of=Fedora-31.vmdk bs=1 seek=$((0x4))

Conversion VMDK vers VMDK (VMDK2VMDK)

Par exemple suite à

openstack image save plop --file plop.vmdk

Conversion VMDK vers VMDK

qemu-img convert -O vmdk plop.vmdk plop2.vmdk

Resize VDI

VBoxManage.exe modifyhd D:\VMs\plop\plop.vdi --resize 40000
2025/03/24 15:06

IMAP dossier partage

Brouillon

Dossier IMAP partagé

Voir :

/etc/dovecot/conf.d/10-mail.conf

mail_plugins = acl

Ajouter imap_acl à la fin de la ligne

/etc/dovecot/conf.d/20-imap.conf

mail_plugins = $mail_plugins imap_acl

Décommenter

/etc/dovecot/conf.d/90-acl.conf

plugin {
  acl = vfile:/etc/dovecot/global-acls:cache_secs=300
}
 
# To let users LIST mailboxes shared by other users, Dovecot needs a
# shared mailbox dictionary. For example:
plugin {
  acl_shared_dict = file:/var/lib/dovecot/shared-mailboxes
}
service dovecot restart

/etc/letsencrypt/cli.ini

# Source : https://gist.github.com/mrothNET/cb6f313e9cbe896f3e0fdec80ad2f3fa
 
# Manage Firewall
#pre-hook = ufw allow http
#post-hook = ufw deny http
 
# Restart Postfix & Dovecot
renew-hook = systemctl restart dovecot.service postfix.service

Astuce : Si rlwrap installé, préfixer votre commande par rlwrap. Il sera plus aissé de rapeller les commandes via fleche du haut

#rlwrap nc localhost 143
#telnet localhost 143
nc localhost 143

rli pour read ®, lookup (l) et insert (i)

. login user P@ssw0rd
. SETACL Sent paul rli
2025/03/24 15:06

Image - pics - Remove the background from an image with this Linux command

Install Rembg on Linux

I created a directory called PythonCoding on my Linux laptop and then made a Python virtual environment:

python3 -m venv PythonCoding
cd PythonCoding
source bin/activate
 
python3 -m pip install rembg

Combine images

I ran the following rembg command to rename it with a shorter filename for convenience:

rembg i dgw_ato.jpeg dgw_noback.jpg

The first time you run rembg, it downloads an open source pattern recognition model. This can be over 100 MB and rembg saves it in your user directory as ~/.u2net/u2net.onnx. The model is the U-2-Net and uses the Apache 2.0 license. For more information about the pattern recognition models (including how to train your own), read the Rembg documentation.

Add a new background

Next, I want to add a new background to the picture. There are different ways to do that. You can, for instance, combine images with ImageMagick, but getting the frame size right can be complex. The easiest way is to use GIMP or Krita.

I used GIMP. First, open the newly created image (ato_image.jpg in my case). Now go to the File menu and select Open as layers. Choose a different image for the background. This image opens as an overlay above the existing photo.

Try Rembg

Rembg has three subcommands you can review in the --help menu:

rembg --help

They are:

  • rembg i for files
  • rembg p for folders
  • rembg s for HTTP server
2025/03/24 15:06

Http - Gros cookies

Limites :

  • Apache - 8K
  • Nginx - 4K-8K
  • IIS - 8K-16K
  • Tomcat - 8K – 48K
  • Node (<13) - 8K; (>13) - 16K

Messages d'erreurs :

  • 400 Bad Request
  • 413 Payload Too Large
  • 413 Request Entity Too Large.

Conf Apache

LimitRequestFieldSize 16384
LimitRequestLine 16384

Conf Nginx

large_client_header_buffers 4 16k

Varnish

DAEMON_OPTS="
...
-p http_req_hdr_len=16k \
-p http_resp_hdr_len=16k" \
...

pfs-sorry-test-gros-cookie.sh

#!/bin/bash
 
set -o errexit
set -o pipefail
set -o nounset
 
if [ "${#@}" -eq 2 ]
then
 
        CookieLen=$1
        TgtUrl=$2
 
        #Cookie=$( cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-"${MaxCookieLen}"} | head -n 1 )
        Cookie=$(eval $(echo printf '0%.0s' {1..${CookieLen}}))
        #wget -4 --no-check-certificate -I -qO- --header "Cookie:${Cookie}" "${TgtUrl}"
        curl -v -k -H "Cookie:${Cookie}" "${TgtUrl}"
else
 
        echo "Missing parameters. Usage $0 Cookie-Size Url"
        exit 1
 
fi
2025/03/24 15:06

Hplip - Imprimante HP Deskjet 3630 sur Debian jessie

http://hplipopensource.com/hplip-web/models/deskjet_aio/deskjet_3630_series.html

Il faut juste une version récente de hplip.

cat > /etc/apt/sources.list.d/backports.list <<EOF
deb http://ftp.debian.org/debian jessie-backports main
EOF
 
apt-get update
apt-get install -t jessie-backports hplip
2025/03/24 15:06
blog.txt · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki