Getting output from SSH commands in Ruby

I usually do SSH in to servers to check if things are okay with raid and shit.

But now I’m going hardcore, with Ruby.

First add NOPASSWD to sudoers to get what commands you want working without password in sudo, with “sudo visudo”

You can probably skip passwords with ssh-copy-id.

This code SSH’s into the server, runs the command, get the ouput, formats it into markdown and writes it to a file, then copies everything to your clipboard so you can paste it into anything you want (say like trello?)

 

Cargo cult programming

Cargo cult programming is a style of computer programming that is characterized by the ritual inclusion of code or program structures that serve no real purpose.

Cargo cult programming is typically symptomatic of a programmer not understanding either a bug he or she was attempting to solve or the apparent solution .

The term ‘cargo cult programmer’ may also apply when an unskilled or novice computer programmer copies some program code from one place and pastes it into another place, with little or no understanding of how the code works, or whether it is required in its new position.

Ubuntu, Eclipse, Golang, Gocode Tutorial

You want to program Golang but having a hard time working on Eclipse to get it working?

Here is a simple speedorial:

1 Eclipse

2 Eclipse Go Settings

  • Go to Window-> Preferences
  • Select Go
  • GOROOT: /usr/lib/go
    GOPATH: /usr/share/go
    Go-tool path: /usr/bin/go
    Go formatter: /usr/bin/gofmt
    Go documentor: /usr/bin/godoc

3 GoCode for Autocompletion

  • Make sure you have git installed: sudo apt-get install git
  • Get gocode with: sudo go get -u github.com/nsf/gocode
  • In Eclipse go to Window-> Preferences
  • Select Go-> Gocode (Submenu)
  • Gocode path: /usr/lib/go/bin/gocode

Kinda shitty written, but this might/maybe/hopefully get you going with autocompletion and everything :)

Crayon Syntax Highlighter test!

Testing a new highlighter!

Function that creates a function and returns that function

Golang find smallest number in array

Well, it works.

Android Torment Day 3

May 17th was celebrated in front of the computer with Eclipse and an AVD.
Friday was battle of the giants where i got Programmers Retard Syndrom.
And starts all over again today.