Skip to content

Instantly share code, notes, and snippets.

View xsaamiir's full-sized avatar
🟡
xoē

sāmīr xsaamiir

🟡
xoē
View GitHub Profile
type FleetVehicle interface {
MakeAndModel() string
}
type Vehicle struct {
Type string `json:"type"`
Make string `json:"make"`
Model string `json:"model"`
}
@xsaamiir
xsaamiir / console.log
Last active June 5, 2020 11:14
terraform validate crash outpout
$ TF_LOG=trace terraform validate (base) 13:02:24 2020-06-05
2020/06/05 13:02:29 [INFO] Terraform version: 0.13.0 beta1
2020/06/05 13:02:29 [INFO] Go runtime version: go1.14.2
2020/06/05 13:02:29 [INFO] CLI args: []string{"/usr/local/bin/terraform", "validate"}
2020/06/05 13:02:29 [DEBUG] Attempting to open CLI config file: /Users/samir/.terraformrc
2020/06/05 13:02:29 Loading CLI configuration from /Users/samir/.terraformrc
2020/06/05 13:02:29 Loading CLI configuration from /Users/samir/.terraform.d/credentials.tfrc.json
2020/06/05 13:02:29 [DEBUG] checking for credentials in "/Users/samir/.terraform.d/plugins"
2020/06/05 13:02:29 [DEBUG] checking for credentials in "/Users/samir/.terraform.d/plugins/darwin_amd64"
2020/06/05 13:02:29 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
@xsaamiir
xsaamiir / README.md
Created March 30, 2020 13:03
Custom hooks in React
@xsaamiir
xsaamiir / LICENSE
Created August 23, 2019 08:19 — forked from x0a1b/LICENSE
Writing delightful middlewares in Go
Copyright (c) 2019 DoorDash
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
CREATE TEXT SEARCH CONFIGURATION fr ( COPY = french );
ALTER TEXT SEARCH CONFIGURATION fr ALTER MAPPING
FOR hword, hword_part, word WITH unaccent, french_stem;
CREATE TEXT SEARCH CONFIGURATION en ( COPY = english );
ALTER TEXT SEARCH CONFIGURATION en ALTER MAPPING
FOR hword, hword_part, word WITH unaccent, english_stem;
CREATE TEXT SEARCH CONFIGURATION de ( COPY = german );
ALTER TEXT SEARCH CONFIGURATION de ALTER MAPPING
@xsaamiir
xsaamiir / upload.go
Created March 7, 2019 20:31
File uploads in Go
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func uploadFile(w http.ResponseWriter, r *http.Request) {
fmt.Println("File Upload Endpoint Hit")
@xsaamiir
xsaamiir / main.go
Last active February 9, 2019 12:39 — forked from cyantarek/main.go
Oauth2 server
package main
import (
"encoding/json"
"fmt"
"github.com/google/uuid"
"gopkg.in/oauth2.v3/models"
"log"
"net/http"
"time"
@xsaamiir
xsaamiir / sem.go
Created January 29, 2019 08:51
Golang goroutines semaphores
package main
import "fmt"
// sem is a channel that will allow up to 10 concurrent operations.
var sem = make(chan int, 10)
func main() {
for {
sem <- 1 // will block if there is MAX ints in sem
@xsaamiir
xsaamiir / mapvisit.go
Created January 27, 2019 19:21
A function to visit every node in a map[string]interface{}
func MapVisitor(mapToVisit map[string]interface{}) {
for k, v := range mapToVisit {
switch val := v.(type) {
case string:
fmt.Println(k, "is string -> ", val)
case float64:
fmt.Println(k, "is float64 -> ", val)
case map[string]interface{}:
MapVisitor(v.(map[string]interface{}))
case []interface{}: