Skip to content

Instantly share code, notes, and snippets.

@otzoran
otzoran / xui
Created October 15, 2013 14:16
from "tweaks..", Ubuntu UI move min/max/close win buttons to the right works for Unity && gnome-fallback/gnome-panel
gconftool-2 --set "/apps/metacity/general/button_layout" --type string ":minimize,maximize,close"
@otzoran
otzoran / vimming
Created October 15, 2013 19:19
vim memo
# copy from vim to XCLIPBOARD, using reg '+' (or '*')
"+yG
@otzoran
otzoran / gist:7214736
Created October 29, 2013 13:35
Mac tricks from HagZag
from iTerm -> clipboard
>> pbcopy < file
@otzoran
otzoran / gist:7439195
Last active December 28, 2015 03:59
sudo nopass
sudo -i
if [[ -d /etc/sudoers.d ]]; then
echo "ori ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/ori
chmod 440 !$
chown root:root !$ #match the owner && perms of README
elif [[ -e /etc/sudoers ]]; then
echo "ori ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
else
echo "Failed to add ori to sudoers"
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:

@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 / 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 / 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 / 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 / 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