This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "gopkg.in/mgo.v2" | |
type Connection struct { | |
DB *mgo.Database | |
} | |
const MongoDb = "test" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shift-Enter run cell | |
Ctrl-Enter run cell in-place | |
Alt-Enter run cell, insert below | |
Ctrl-m x cut cell | |
Ctrl-m c copy cell | |
Ctrl-m v paste cell | |
Ctrl-m d delete cell | |
Ctrl-m z undo last cell deletion | |
Ctrl-m – split cell | |
Ctrl-m a insert cell above |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Installing | |
$ docker version | |
$ docker run hello-world // Runs the Hello World sample. Downloads from Dockerhub if it isn't available locally | |
$ docker ps -a // Prints out all available containers on local machine | |
$ docker ps // Prints out all running containers on local machine | |
## Searching and runing | |
$ docker search whalesay | grep docker // Searches docker hub and filters with grep | |
$ docker run docker/whalesay cowsay Hello |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Start mysql | |
$ mysql.server start | |
Login as root | |
$ mysql -u root -p | |
Show databases | |
mysql> SHOW DATABASES | |
Create database |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Postgres cheat sheet | |
Note on prompts: | |
$ The command is run from the unix shell | |
# The command is run from psql, logged in as the default user. | |
=> The command is run from psql, logged in as a specific user. | |
Make sure that psql will auto start | |
$ pg_ctl -D /usr/local/var/postgres start && brew services start postgresql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Data Preprocessing Template | |
# Importing the libraries | |
import numpy | |
import matplotlib.pyplot | |
import pandas | |
from sklearn.preprocessing import Imputer | |
from sklearn.preprocessing import LabelEncoder, OneHotEncoder, StandardScaler | |
from sklearn.cross_validation import train_test_split |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
type person struct { | |
fname string | |
lname string | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Print header | |
func myFunc(w http.ResponseWriter, r *http.Request) { | |
for k, v := range r.Header { | |
log.Println("key:", k, "value:", v) | |
} | |
} | |
// A. Print type of variable | |
fmt.Printf("Type of x %T\n", x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Navigation | |
### Switch panes | |
ctrl-w, then arrow | |
ctrl-F Move to next screen | |
## NERDTree | |
m: Access menu | |
ctrl-k b Open NERDTree | |
## Run Unix command |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mongo 199.124.1.2:12128/dbname -u dbusername -p dbpassword | |
1 2 3 4 5 | |
Explanation for those who are struggling | |
1. you server static IP address | |
2. you exposed port no (any in one of the four user B when A->B) | |
3. your databasename this is what you enter while you run this command dokku mongo:create dbname | |
4 & 5. you will get this when running dokku mongo:info |