January 12, 2017

golang vim-go setup

1. start with a fresh ~/.vim directory
2. install vim-plug if don't have it:
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
3. add the following to your .vimrc file
call plug#begin()
Plug 'tpope/vim-sensible'
Plug 'fatih/vim-go'
Plug 'tmhedberg/matchit'
call plug#end()

au FileType go nmap <C-K> <Plug>(go-doc)
let g:go_fmt_command = "goimports"
4. inside vim, run "PlugInstall". This installs the plugins specified above. Restart vim. All plugins should be working now.
5. For vim-go, run ":GoInstallBinaries" to install missing tools needed by vim-go
6. Now Shift-K/Ctrl-K should run go-doc for the keyword under cursor.

 Note for go-doc to work correctly, the go source code file has to be in $GOPATH/src/package-name. It cannot not be a symlink outside of GOPATH. It cannot be a raw *.go file under $GOPATH/src either. It needs to be under a package directory.

January 6, 2017

windows 10 folder sort slow in file explorer

I solved this by unchecking the "Allow Files in the folder to have contents indexed in addition to file properties" option. You do this by first getting the Properties of the folder, then on the General tab press the Advanced button in the Attributes section. Apply the changes to the folder and , subfolders and files.      

December 29, 2016

debian/ubuntu snmp has lots of "error on subcontainer ‘ia_addr’ insert (-1)" reports in /var/log/syslog

Modifying /etc/defaults/snmpd and setting "-Lsd" to "-LS6d" in SNMPDOPTS and TRAPDOPTS hides the error message (as suggested by http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=559109).

Or you can use  `sed -i "s|-Lsd|-LS6d|" /etc/default/snmpd`  to fix the problem.

November 30, 2016

solve kvm soft lockup


Update: setting to jiffies on my guest seems to be the most stable (no lockups yet in the last 24 hours)

Original Post:
I googled around and by adding clocksource=jiffies to my kernel i fixed it. Instead of jiffies you could also try "pit". This is for the guest OS. You can also use kvm-clock if that is available to you. To check, run the following commands and see whether kvm-clock is available

# cat /sys/devices/system/clocksource/clocksource0/available_clocksource 
tsc hpet acpi_pm jiffies 
# cat /sys/devices/system/clocksource/clocksource0/current_clocksource 

Some people say that the best option for a precise clock on the guest is to use the kvm-clock source (pvclock) which is synchronized with clock's host.

There are also reports of disabling C-states in the BIOS.

November 16, 2016

gvim set size and color scheme

put this in ~/_vimrc:

set lines=51 columns=200
winpos 56 56
colorscheme desert

November 4, 2016

batteries, material, voltage

Carbon zinc - non-reversible, 1.5v

Alkaline - non-reversible (basically, but some reversibility can be forced) 1.5 v

NiCd - reversible - 1.2v nominal, 1.35v fully charged, 0.9v discharged

NiMH - reversible - 1.2 v nominal, 1.35 - 1.4v fully charged, 1.0 v discharged

Lead Acid - reversible, 2.0v discharged, 2.3v charged

Lithium Polymer - reversable - 3.7v nominal, 4.2v fully charged, 3.0 discharged

Lithium Ion (LiFePO4) - reversable - 3.3v nominal, 3.6v fully charged, 2.8v discharged  

October 11, 2016

hexdump is awesome

it can dump binary with any specified format

hexdump -e '"optional-start" iterations/number_of_bytes "format" "optional-ending"'

For example:
hexdump -e '"[" 12/1 "%02 " "]\n"' x.bin

will dump 12 bytes in a row with [ in the beginning and ] at the end.