Skip to content

Instantly share code, notes, and snippets.

@otzoran
otzoran / piix4_smbus.md
Last active January 29, 2023 16:45
VirtualBox piix4_smbus Error during VM boot

Problem

During VM boot we see an error from piix4_smbus and in dmesg something like:

piix4_smbus 0000:00:07.3: Host SMBus controller not enabled!

This error is caused by VM having no smbus but Ubuntu always trying to load the module. It doesn’t affect anything but is a bit annoying. Originally this error was reported on VirtualBox and Ubuntu 10.10, but I still see it in Ubuntu 13.10. It also exist on VMware Fusion.

@otzoran
otzoran / brewupd.sh
Last active October 1, 2021 11:30
Automate brew update
#!/usr/bin/env bash
# curl -o xx https://gist.githubusercontent.com/otzoran/0214f5f9e817c54c597da31dd86c9162/raw
TIM=60
PROG=$(basename $0)
trap 'echo "ERROR $? at ${PROG}:$LINENO - [$BASH_COMMAND]"' err
function wait_confirmation
{
@otzoran
otzoran / vagrant-snippet.rb
Last active October 9, 2018 06:55
Vagrant
## Vagrantfile
config.vm.provider :virtualbox do |vb|
# start windowed (default is headless)
vb.gui = true
vb.customize [ "modifyvm", :id, "--memory", "512"]
vb.name = "#{NAME}"
@otzoran
otzoran / msfonts_wrapper.sh
Created October 10, 2013 17:08
Add Microsoft Fonts (Including Tahoma) on Ubuntu; tested on 12.x, 13.04
#!/bin/bash
# Install Microsoft Fonts (Including Tahoma) on Ubuntu
# Source: http://ubuntuforums.org/archive/index.php/t-1459709.html
# Ubuntu Forums > The Ubuntu Forum Community > Ubuntu Specialised Discussions > Art & Design > [SOLVED] How to Install Tahoma TTF
# by trentscott, April 22nd, 2010, 12:51 AM :: Simplified by me
prog=$(basename $0)
if [ $(id -u) != 0 ]; then
@otzoran
otzoran / prep-vbox-export.md
Last active December 31, 2017 12:57
prepare a vbox VM for export

as root

cat /dev/zero > /EMP000

then

rm /EMP000

@otzoran
otzoran / json2yaml.md
Last active October 17, 2017 08:48
json2yaml and yaml2json oneliners using ruby

Add to bashrc

alias yaml2json="ruby -ryaml -rjson -e 'puts JSON.pretty_generate(YAML.load(ARGF))'"
alias json2yaml="ruby -ryaml -rjson -e 'puts YAML.dump(JSON.parse(STDIN.read))'"

WIIG4

take a horrible json (such as packer template), convert it to yaml, edit it (vi, sed, awk) and convert back

side dish

@otzoran
otzoran / vbox_NS_ERROR_FAILURE_resolve.md
Created July 25, 2017 16:25
virtualbox VM in Saved state fail start with NS_ERROR_FAILURE machinewrap

Problem

macOS Sierra 10.12.5
VBoxManage --version = 5.1.24r117012
Win VM paused, mac => sleep; on wakeup attaempt to rev the VM yields error:
The virtual machine '[name]' has terminated unexpectedly during startup because of signal 6.
NS_ERROR_FAILURE (0x80004005)

Googling

@otzoran
otzoran / ntp_iix.md
Last active August 26, 2016 01:05
NTP Server Israel

NTP Server Israel

source: isoc-il

timeserver.iix.net.il   # 192.114.62.250 stratum-2
@otzoran
otzoran / snuppet.sh
Created January 12, 2016 23:25
pbcopy/paste on Linux
# pbcopy (on Mac OS), copies stdin to the X clipboard, the aliases created here simulate that.
# need the 'xsel' package
if [[ $(uname -s) == "Linux" && -x /usr/bin/xsel ]]; then
alias pbcopy='xsel --clipboard --input'
alias pbpaste='xsel --clipboard --output'
fi
@otzoran
otzoran / git-memo.md
Last active December 30, 2015 12:59
git memo

uploaded from otxe6530::git-memo

undo commit

git reset --soft HEAD^	    #and move from that commit to staging

git reset --hard HEAD^	    #and wipe changes, files aren't put in staging (reverted)

git reset --hard HEAD^^	    #revert to 2 commits back

Here's a comforting quote from Scott Chacon: