Skip to content

Instantly share code, notes, and snippets.

@filimonov
filimonov / replug_vbox_network.cmd
Last active Aug 9, 2020
"Replug" the cable of running VirtualBox VM (network freeze in guest VM after host windows hybernate - awake)
View replug_vbox_network.cmd
@echo off
set VboxManageEXE="%VBOX_MSI_INSTALL_PATH%\VBoxManage.exe"
set ListRunningVMS=%VboxManageEXE% list runningvms
for /f tokens^=2^,4^ delims^=^" %%p in ('%ListRunningVMS%') do (
echo "%%p"
%VBoxManageEXE% controlvm %%p setlinkstate1 off
%VBoxManageEXE% controlvm %%p setlinkstate1 on
)
@wpscholar
wpscholar / array-insert-after.php
Created Nov 7, 2015
Insert a value or key/value pair after a specific key in an array. If key doesn't exist, value is appended to the end of the array.
View array-insert-after.php
<?php
/**
* Insert a value or key/value pair after a specific key in an array. If key doesn't exist, value is appended
* to the end of the array.
*
* @param array $array
* @param string $key
* @param array $new
*