Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am mkouhei on github.
  • I am mkouhei (https://keybase.io/mkouhei) on keybase.
  • I have a public key ASCavMjcOaUTEITfPy8Qow5BWplR3W7qwJ5dsYw70URKswo

To claim this, I am signing this object:

$vmname = $one
function Show-VM-Info {
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" showvminfo $vmname
}
function VM-Powered-off? {
Show-VM-Info | Select-String State: | Select-String -quiet 'powered off'
}
$vmname = $one
function Show-VM-Info {
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" showvminfo $vmname
}
function VM-Powered-off? {
Show-VM-Info | Select-String State: | Select-String -quiet 'powered off'
}
#!/bin/bash -e
read -p 'Enter passphrase:' -s pass
for i in id_rsa
do
expect << EOF
spawn ssh-add $HOME/.ssh/${i}
expect "Enter passphrase for $HOME/.ssh/${i}:"
send "$pass\r"
expect eof
EOF
#!/bin/sh -e
vmname=$1
#VBoxManage modifyvm $vmname --biossystemtimeoffset $(( 1000 * 60 * 60 * 3 ))
VBoxManage modifyvm $vmname --biossystemtimeoffset 0
#!/bin/sh -e
vmname=$1
VBoxManage showvminfo $vmname | grep State: | grep -q 'powered off' || ( echo "VM: $vmname is not powered off."; exit 1 )
VBoxManage clonevm --mode machine --options keepallmacs --name "${vmname}_tmp" --register
#!/bin/sh -e
vmname=$1
VBoxManage showvminfo $vmname | grep State: | grep -q 'powered off' || ( echo "VM: $vmname is not powered off." ; exit 1 )
VBoxManage snapshot $vmname take $(date +%Y%m%d-%H%M)
if [ $(VBoxManage snapshot $vmname list | wc -l) -lt 4 ]; then
exit 0
fi
VBoxManage snapshot $vmname delete $(VBoxManage snapshot $vmname list | head -1 | awk '{print $2}')
#!/bin/sh -e
vmname=$1
VBoxManage showvminfo $vmname | grep State: | grep -q 'powered off' || ( echo "VM: $vmname is not powered off." ; exit 1 )
VBoxManage startvm $vmname --type gui
@mkouhei
mkouhei / rbtox.sh
Created November 10, 2015 07:08
automate testing in Ruby as like the tox https://testrun.org/tox/latest/
#!/bin/sh -e
if [ -f .ruby-version ]; then
RUBY_VER=$(cat .ruby-version)
fi
test -f /etc/debian_version && PATCH="https://bugs.ruby-lang.org/attachments/download/5479/ruby-sslv3.diff"
if [ ! -z $RUBY_VER ]; then
if [ x"$(rbenv version | awk '{print $1}')" != x"$RUBY_VER" ]; then
WARNING: dot code u'blockdiag {\norientation = portrait;\npython-celery -> python-kombu -> python-libr
abbitmq -> librabbitmq1;\npython-kombu -> python-amqp;\n}': The _imagingft C module is not installed
WARNING: dot code u'blockdiag admin {\n node_width = 60;\n span_width = 180;\n app0 [label="app-a"]
;\n app1 [label="app-b"];\n nginx -> app0 [label="0-11\u6642\u53f0\u306e\u632f\u308a\u5206\u3051\u51
48"];\n nginx -> app1 [label="12-23\u6642\u53f0\u306e\u632f\u308a\u5206\u3051\u5148"];\n}': The _imag
ingft C module is not installed
--------------------------------------------------------------------
PIL SETUP SUMMARY
--------------------------------------------------------------------