Tips and tricks: Difference between revisions
From DWIKI
mNo edit summary |
mNo edit summary |
||
(4 intermediate revisions by the same user not shown) | |||
Line 35: | Line 35: | ||
In this case your scsi device is 7, so | In this case your scsi device is 7, so | ||
echo "- - -" > /sys/class/scsi_host/host7/scan | echo "- - -" > /sys/class/scsi_host/host7/scan | ||
=Find your public IP= | |||
curl icanhazip.com | |||
or | |||
curl my.ip.fi | |||
and https://ifconfig.co/ | |||
=Downlowd mp3 from youtube= | |||
youtube-dl -x --audio-format mp3 URL | |||
=Decimal to binary= | |||
echo "obase=2; $var" | bc |
Latest revision as of 10:30, 17 April 2024
Clone disk over ssh
On remotehost:
- have a user 'someuser' you can ssh to with key, so without password. This user must NOT be in wheel/sudoers/admin group!!!
add a line "someuser ALL=(ALL) NOPASSWD: /bin/dd
Then you can run
ssh -C -t someuser@remotehost "dd if=/dev/sdXX" | dd of=/dev/sdXY
Note the "-t" which is required, otherwise you get "sudo: no tty present and no askpass program specified"
Generate random mac address
#!/usr/bin/python # macgen.py script to generate a MAC address for guest virtual machines # import random # def randomMAC(): mac = [ 0x00, 0x16, 0x3e, random.randint(0x00, 0x7f), random.randint(0x00, 0xff), random.randint(0x00, 0xff) ] return ':'.join(map(lambda x: "%02x" % x, mac)) # print randomMAC()
Add disk to VM
cat /proc/scsi/scsi Attached devices: Host: scsi7 Channel: 00 Id: 00 Lun: 00 Vendor: VMware Model: Virtual disk Rev: 1.0 Type: Direct-Access ANSI SCSI revision: 02
In this case your scsi device is 7, so
echo "- - -" > /sys/class/scsi_host/host7/scan
Find your public IP
curl icanhazip.com
or
curl my.ip.fi
Downlowd mp3 from youtube
youtube-dl -x --audio-format mp3 URL
Decimal to binary
echo "obase=2; $var" | bc