Skip to content

Instantly share code, notes, and snippets.

View hfogelberg's full-sized avatar

Henrik Fogelberg hfogelberg

View GitHub Profile
@hfogelberg
hfogelberg / vim.rc
Created March 10, 2015 10:12
vim.rc
" This must be first, because it changes other options as a side effect.
set nocompatible
execute pathogen#infect()
syntax enable
set background=light
let g:solarized_colorscheme=256
colorscheme solarized
<html>
<head><title>Geocoding</title>
<meta name="viewport" content="width=device-width maximum-scale=1 initial-scale=1 user-scalable=no">
<link rel="stylesheet" type="text/css" href="../../style.css"/>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true"></script>
</head>
<body>
<h2>Geocoding</h2>
<p id="progress">Checking position</p>
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
## 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
// 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)
package main
import (
"fmt"
)
type person struct {
fname string
lname string
}
# 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
# 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
Start mysql
$ mysql.server start
Login as root
$ mysql -u root -p
Show databases
mysql> SHOW DATABASES
Create database
@hfogelberg
hfogelberg / Docker
Last active October 26, 2017 13:40
## 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