Skip to content

Instantly share code, notes, and snippets.

View twiny's full-sized avatar
💫
ping ~ pong

IM twiny

💫
ping ~ pong
View GitHub Profile
@twiny
twiny / kubectl.md
Last active April 19, 2023 23:48
kubectl commonly used commands

kubectl Commands

Cluster Information

  • kubectl version - Display the Kubernetes version running on the client and server
  • kubectl cluster-info - Show cluster information
  • kubectl get componentstatuses - List the status of cluster components
  • kubectl api-resources - List the supported API resources on the server

Resources

@twiny
twiny / git-cheatsheet.md
Last active April 19, 2023 11:03
git command cheatsheet

git command cheatsheet

Branches

  • git branch -M old_branch_name new_branch_name
  • git checkout -b <name> New branch
  • git checkout <name> Existing branch
  • git switch -c <name> New branch
  • git switch <name> Existing branch
  • git branch List local branches
  • git branch -a List all branches
@twiny
twiny / ch_range.go
Created August 25, 2021 18:59
exiting a "for range" loop on a channel.
package main
import (
"fmt"
"runtime"
"time"
)
func main() {
ch := make(chan int, runtime.NumCPU())
@twiny
twiny / command_queue.go
Created August 5, 2021 16:25
a queue you can pause/start/stop using channels
package main
import (
"fmt"
"sync"
"time"
)
type State string
// SQLiteStore
type SQLiteStore struct {
db *sql.DB
}
// Backup: copy database src to dst.
func (sl *SQLiteStore) Backup(src, dst string) error {
// to lock database during copy
tx, err := sl.db.Begin()
if err != nil {
@twiny
twiny / main.go
Created June 10, 2021 10:20 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@twiny
twiny / client.go
Created May 30, 2021 20:35 — forked from jordanorelli/client.go
rpc server example in go
package main
import (
"bufio"
"log"
"net/rpc"
"os"
)
func main() {
@twiny
twiny / docker-compose.yml
Created May 3, 2021 01:15 — forked from Mau5Machine/docker-compose.yml
Traefik Configuration and Setup
version: "3.3"
services:
################################################
#### Traefik Proxy Setup #####
###############################################
traefik:
image: traefik:v2.0
restart: always