Skip to content

Instantly share code, notes, and snippets.

View indrasaputra's full-sized avatar
🎯
Focusing

Indra Saputra indrasaputra

🎯
Focusing
View GitHub Profile
- iTerm2
- set default window -> save arrangement -> use default
- brew
- go
- mockgen
- golangci-lint
- all dependencies in repo indrasaputra/toggle
- vscode
- docker
- telegram
# delete all untagged docker images
docker rmi -f $(docker images -a | awk '/none/ {print $3}')
# delete all unnecessary volume
docker volume ls | grep -v DRIVER | awk '{print $2}' | grep -x '.\{30,100\}' | xargs docker volume rm
# delete all past container
docker ps -a | grep -v CONTAINER | awk '{print $1}' | xargs docker rm -f
package main
import "fmt"
// Distance defines the distance of a point
// using row and column as measurement.
type Distance struct {
Row int
Column int
}
func (c *Checker) CheckStandardsGoroutineChannel(ctx context.Context, svc *Service, svcChan chan *Service, errChan chan []error) {
// this function still does what CheckStandards does,
// but instead of returning the values,
// it sends the values to channel
svcChan <- svc
errChan <- errorList
}
func main() {
ctx := context.Background()
func main() {
ctx := context.Background()
kube := &Kubernetes{}
checker := &Checker{}
services, _ := kube.AllServices(ctx)
// let's make a new services container
// so we don't bother with pointer
type Kubernetes struct {
// omitted
}
type Service struct {
Name string
HasMetric bool
HasLog bool
HasDocument bool
HasCICD bool
package blog
import "time"
// Article is our beloved article struct.
// This struct can be moved to another package,
// such as `package entity`.
// But, I choose to put it here because
// of readability reason.
type Article struct {
// Blog is the main business process(es).
type Blog interface {
// CreateArticle creates an article then publish it.
CreateArticle(article Article) error
// GetArticles retrieves an article based on its id.
GetArticle(id int) (Article, error)
}
#include <cstdio>
#include <iostream>
#include <cstring>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <map>
#include <utility>
#include <cctype>
#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <queue>
#include <stack>