hooku

Please enjoy some eccentric technologies.

常用脚本/命令

Script

Windows

  • Enable NAT forward and DNS proxy
    netsh routing ip nat install
    netsh routing ip nat add interface "WLAN" full
    netsh routing ip nat add interface "TAP" private
    netsh routing ip dnsproxy set interface="TAP" mode=enable
    
  • Enable port forwarding
    // add:
    netsh interface portproxy add v4tov4 listenport=80 listenaddress=0.0.0.0 connectport=80 connectaddress=192.168.0.254
    // remove:
    netsh interface portproxy delete v4tov4 listenport=80 listenaddress=0.0.0.0
    

Linux

  • File count

    find DIR_NAME -type f | wc -l
    
  • User mode samba It is possible to run the samba server as a user process.

    /usr/sbin/smbd -iFS -s ./smb.conf
    
  • List subfolder size(sorted)

    du -hs * | sort -hr
    
  • Monitor CPU Frequency

    watch -n.1 "grep \"^[c]pu MHz\" /proc/cpuinfo"
    

Excel

  • Compare Col A and Col B
    =if(countif($B:$B, $A1)<>0, "-", "Not in B")
    

VirtualBox

  • VM disk related
    // create:
    VBoxManage internalcommands createrawvmdk -filename "C:\Users\B57742\VirtualBox VMs\centos\centos.vmdk" -rawdisk \\.\PhysicalDrive0 -partitions 4
    // list:
    VBoxManage internalcommands listpartitions -rawdisk \\.\PhysicalDrive0
    

VM Network Related

  • Network limit
    // add limit:
    VBoxManage bandwidthctl "centos" add Limit --type network --limit 16k
    VBoxManage modifyvm "centos" --nicbandwidthgroup1 Limit
    // modify limit:
    VBoxManage bandwidthctl "centos" set Limit --limit 128k