Skip to content

Instantly share code, notes, and snippets.

View dxavx's full-sized avatar
🏠
Working from home

dxavx dxavx

🏠
Working from home
View GitHub Profile
@dxavx
dxavx / const.go
Last active January 5, 2020 21:28
Golang const
package main
import "fmt"
const pi = 3.14
const (
hello = "Hello"
e = 2.718
)
@dxavx
dxavx / pointers.go
Created January 5, 2020 19:38
Golang pointers
package main
import "fmt"
func main() {
a := 2
b := &a
*b = 3 // a = 3
c := &a // new variable pointer A
fmt.Println(a, b, c)
@dxavx
dxavx / strings.go
Created January 5, 2020 22:36
Golang strings
package main
import (
"fmt"
"unicode/utf8"
)
func main() {
// empty string
var str string
@dxavx
dxavx / strings.go
Created January 6, 2020 08:10
Golang variables
package main
import (
"fmt"
"unicode/utf8"
)
func main() {
// empty string
var str string
@dxavx
dxavx / loop.go
Created January 6, 2020 13:04
Golang loops
package main
import "fmt"
func main() {
// loop without condition, while(true) OR for(;;;) infinite loop
for {
fmt.Println("loop iteration")
break
}
@dxavx
dxavx / control.go
Created January 6, 2020 15:25
Golang if and switch
package main
import "fmt"
func main() {
// simple conditions
boolVal := true
if boolVal {
fmt.Println("boolVal is true")
}
@dxavx
dxavx / main.go
Created January 6, 2020 21:21
Content type definition
package main
import (
"fmt"
"net/http"
"os"
)
func main() {
@dxavx
dxavx / docker-compose.yml
Last active January 7, 2020 10:22
Minio docker-compose
version: '3.7'
services:
minio:
image: 'minio/minio'
restart: always
hostname: minio
volumes:
- minio:/data
ports:
@dxavx
dxavx / docker.sh
Created January 9, 2020 14:26
docker delete volumes
# Search for all unnecessary volumes
docker volume ls -f dangling=true
# delete these volumes
docker volume prune
@dxavx
dxavx / array.go
Created January 10, 2020 16:52
Golang array
package main
import "fmt"
func main() {
// array size is part of its type
// initialization of default values
var a1 [3]int // [0,0,0]
fmt.Println("a1 short", a1)
fmt.Printf("a1 short %v\n", a1)