Hello Gopher
Download and install
Download Golang and install it.
Create your workspace
$ mkdir goprojects
$ export GOPATH=$HOME/goprojects
$ cd goprojects
$ mkdir -p src/github.com/jazminschroeder
$ cd src/github.com/jazminschroeder
Creating a project
$ mkdir hello_gopher
$ cd hello_gopher
$ vim hello_gopher.go
# Hello gopher
package main
import "fmt"
func main() {
fmt.Println("Hello gopher!!!")
}
Go install
$ go install
Say hello gopher!
$ ~/goprojects/bin/hello
$ Hello gopher!!!
Mysql Query From Binary to Uuid
From binary to uuid
SELECT
LOWER(
CONCAT(
LEFT(HEX(binary_field), 8),
'-',
MID(HEX(binary_field), 9, 4),
'-',
MID(HEX(binary_field), 13, 4),
'-',
MID(HEX(binary_field), 17, 4),
'-',
RIGHT(HEX(binary_field), 12)
)
) AS uuid
FROM some_table
Ruby and Statsd
Graph everything
https://github.com/reinh/statsd
require 'statsd'
statsd = Statsd.new('localhost', 9125)
statsd.namespace="some.namespace"
#Sending data
statsd.increment 'foo.bar'
Dyld: Library Not Loaded: /usr/local/lib/libevent-2.0.5.dylib
Problems with tmux?
$ tmux
dyld: Library not loaded: /usr/local/lib/libevent-2.0.5.dylib
# Install libevent
$ brew install libevent
Warning: libevent-2.0.21 already installed
# Already intalled. Where is it?
$brew link libevent
Warning: Already linked: /usr/local/Cellar/libevent/2.0.21
To relink: brew unlink libevent && brew link libevent
# Relink it
$brew unlink libevent && brew link libevent
RabbitMQ From the Command Line
List queues messages and consumers
$ sudo rabbitmqctl list_queues name messages consumers
Listing queues ...
test.two.queue 0 0
test.one.queue 0 0
List exchanges
$ sudo rabbitmqctl list_exchanges
Using Tags With Cucumber
@mytag
Scenario:
$ cucumber --tags @mytag
Syncing a Fork
#Set a new remote for the orinal repository
$ git remote add upstream git@github.com:jazminschroeder/repo.git
#fetch upstream's branches
$ git fetch upstream
#merge upstream
$ git merge upstream/master
Mongo - List All Collections
> show dbs
> use my_database
> show collections
Neo4J Change Default Remote Shell Port
Neo4j remote shell port defaults to 1337. How to change it?
# /usr/local/neo4j-server/conf/neo4j.properties
remote_shell_port = 1338
Cucumber Scenario Outlines
Scenario Outline: Table example
Given I have an "<option>"
Then I should see "<result>"
Examples:
| option | result |
| option 1 | result 1 |
| option 2 | result 2 |