Skip to content

Instantly share code, notes, and snippets.

View breml's full-sized avatar

Lucas Bremgartner breml

View GitHub Profile
@dlupu
dlupu / hotwire_stimulus_2_0.md
Last active March 16, 2022 19:02 — forked from scottharvey/stimulus.md
Hotwire Stimulus 2.0 cheatsheet (in the process of being updated). If you have any feedback, please comment.
@m-radzikowski
m-radzikowski / script-template.sh
Last active May 4, 2024 04:13
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@asrivascrealytee
asrivascrealytee / grafana.nomad.hcl
Created March 11, 2019 16:17
Grafana+loki+promtail nomad example
job "grafana" {
datacenters = ["dc1"]
type = "service"
group "grafana" {
count = 1
restart {
attempts = 10
interval = "5m"
@zupzup
zupzup / main.go
Created September 15, 2018 14:17
Log deletion script for ELK-stack logs written in Go
package main
import (
"context"
"flag"
log "github.com/sirupsen/logrus"
"gopkg.in/olivere/elastic.v6"
"os"
"strings"
"time"
@zhunik
zhunik / docker-compose.yml
Created September 14, 2018 15:12
docker-compose Postgres health-check
version: "3"
services:
postgress:
....
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
app:
@mrmartineau
mrmartineau / stimulus.md
Last active April 19, 2024 09:41
Stimulus cheatsheet
@vikramdurai
vikramdurai / gocalc.go
Last active November 6, 2023 15:44
A simple calculator made with Go
package main
import (
"bufio"
"errors"
"fmt"
"os"
"strconv"
"strings"
)
@lestrrat
lestrrat / stages.md
Last active May 18, 2022 02:19
Seven Stages of Becoming a Go Programmer
  • stage 1: You believe you can make Go do object oriented programming. You want to do this by using clever struct embedding.
  • stage 2: You believe goroutines will solve all of your problems. You want to use goroutines for anything and everything that you can, who cares if the code becomes a bit more complicated
  • stage 3: You believe that instead of object oriented programming, interfaces will solve all of your problems. You want to define everything in terms of interfaces
  • stage 4: You believe channels will solve all of your problems. You want to do everything from synchronization, returning values, and flow control using channels.
  • stage 5: You now believe Go is not as powerful as people claim it to be. You feel like you're stripped of all of the nice tools and constructs that other languages provide.
  • stage 6: You realize that stages 1~5 were all just your imagination. You just didn't want to accept the Go way. Everything starts to make sense.
  • stage 7: You are now at peace
@posener
posener / go-shebang-story.md
Last active March 29, 2024 08:38
Story: Writing Scripts with Go

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.

Run go install and

  • gogitlocalstats -add /path/to/folder will scan that folder and its subdirectories for repositories to scan
  • gogitlocalstats -email your@email.com will generate a CLI stats graph representing the last 6 months of activity for the passed email. You can configure the default in main.go, so you can run gogitlocalstats without parameters.

Being able to pass an email as param makes it possible to scan repos for collaborators activity as well.

License: CC BY-SA 4.0