Skip to content

Instantly share code, notes, and snippets.

View mbonell's full-sized avatar

Marcela Bonell mbonell

View GitHub Profile
package main
import (
"io"
"net/http"
)
func hello(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, "Hello World!")
}
package main
import (
"log"
"net/rpc"
"github.com/techwo/rpc-server/service"
)
// Calculator stands for the RPC client implementation.
package main
import (
"log"
"net"
"net/http"
"net/rpc"
"github.com/techwo/rpc-server/service"
)
package service
import (
"errors"
"log"
)
// Calculator represents the service available over the network.
type Calculator int
package service
// Operations stands for all the remote fuctions definition in the service.
type Operations interface {
Addition(*Request, *Response) error
Subtraction(*Request, *Response) error
}
package service
// Request represents the data args for the service.
type Request struct {
A, B float64
}
// Response represents the data results from the service.
type Response struct {
Result float64
@mbonell
mbonell / main.go
Last active January 5, 2018 23:09
RPC client implementation for https://github.com/mbonell/simple-rpc-server
package main
import (
"log"
"net/http"
"net/rpc"
"github.com/mbonell/simple-rpc-server/models"
)
package main
import (
"fmt"
"log"
"os"
"time"
"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/openstack"
#!/bin/sh
sudo apt-get update
sudo apt-get install apache2 apache2-doc apache2-utils libexpat1 ssl-cert -y
wget https://gist.githubusercontent.com/MBonell/d1ac6700859db234b3d00151733997fe/raw/97addf5576725a67922e04e2f3b8c82854e9d8ad/example.html
sudo cp example.html /var/www/html/index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="theme-color" content="#6D506E" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hello Cloud App Devs</title>
<link href="https://fonts.googleapis.com/css?family=Pacifico" rel="stylesheet">