Skip to content

Instantly share code, notes, and snippets.

View adefemi171's full-sized avatar
💭
Listening to Music

Adefemi adefemi171

💭
Listening to Music
View GitHub Profile
@adefemi171
adefemi171 / config.yml
Created May 21, 2022 01:37
Circle CI Configuration for Post
version: 2.1
jobs:
Lint:
docker:
- image: cimg/go:1.13
steps:
- checkout
- run: go vet -v ./...
- run : go fmt ./...
Test:
@adefemi171
adefemi171 / main.go
Last active April 17, 2021 13:58
Sending Email using go-simple-mail
package main
import (
"crypto/tls"
"log"
"os"
"time"
"github.com/joho/godotenv"
mail "github.com/xhit/go-simple-mail/v2"
@adefemi171
adefemi171 / romantoint.go
Created December 23, 2020 23:21
LEETCODE 13. Roman to Integer
func romanToInt(s string) int {
valMap := map[string]int{
"I": 1,
"V": 5,
"X": 10,
"L": 50,
"C": 100,
"D": 500,
"M": 1000,
@adefemi171
adefemi171 / .gitlab-ci.yml
Created December 17, 2020 16:42
GitLab config for Golang
# using Golang as the image
image: golang:latest
variables:
# Please edit to your GitLab project
REPO_NAME: gitlab.com/adefemi171/golang-webserver
# This section run before the job
# to be able to use go get, one needs to put
# the repository in the $GOPATH. So for example if your gitlab domain
@adefemi171
adefemi171 / gist:555d9eaae0f44fa7a311b9a502fccd8a
Created December 15, 2020 13:08
Install gitlab runner package for deb amd64
// install package
dpkg -i gitlab-runner_amd64.deb
@adefemi171
adefemi171 / file2.txt
Created December 15, 2020 12:08
Format and run go code
// format your code for code clean up
go fmt
// run the webserver using
go run main.go
@adefemi171
adefemi171 / main.go
Created December 15, 2020 10:32
The static web server
package main
import (
"encoding/json"
"flag"
"fmt"
"log"
"net/http"
"os"
"time"
@adefemi171
adefemi171 / file.txt
Created December 15, 2020 10:25
main.go file
// creating main.go file using touch
// you can call this file any name
touch main.go
// creating main.go file using nano
nano main.go
// this will open up a text editor, copy and paste the code
// then pres ctrl + o and ctrl+x to save and exit accordingly
@adefemi171
adefemi171 / gist:2a352bf5fdf44f3271928e1ede3fc29d
Last active December 15, 2020 04:30
Golang Installation
// update server repository
sudo apt-get update && sudo apt-get upgrade -y
// Downlod the version of your choice
// am using go1.15.5
wget https://golang.org/dl/go1.15.5.linux-amd64.tar.gz
// Unzip Golang using tar
tar xvf go1.15.5.linux-amd64.tar.gz
// update the server repository
sudo apt-get update && sudo apt-get upgrade -y
// install docker
sudo apt-get install -y docker.io
// Enable and start docker
sudo systemctl enable docker
sudo systemctl start docker