Skip to content

Instantly share code, notes, and snippets.

View smebyp1's full-sized avatar

Jarvis smebyp1

  • Business Account
  • Raleigh, NC
View GitHub Profile

Docker on Lima (lima-vm/lima) Setup Guide

In recent months, Lima has become de facto standard software as a free and open source alternative to Docker Desktop for Mac. Several projects (such as Colima, Rancher Desktop, or Finch) for similar purpose also uses Lima as their backend. These projects will make it easier to set up Lima. But some people may not want to introduce extra components other than Lima. This guide will show you how to set up Lima to be alternative to Docker Desktop for Mac, while using Lima only.

🪣 Note. It is a good practice to uninstall Docker Desktop for Mac before proceeding with the following steps.

1. Install Lima and Docker CLI

@smebyp1
smebyp1 / renew-gpgkey.md
Last active February 7, 2023 19:18 — forked from krisleech/renew-gpgkey.md
Renew Expired GPG key

Renew GPG key

Given that your key has expired.

$ gpg --list-keys
$ gpg --edit-key KEYID

Use the expire command to set a new expire date:

@smebyp1
smebyp1 / load_dotenv.sh
Created January 3, 2023 14:15 — forked from mihow/load_dotenv.sh
Load environment variables from dotenv / .env file in Bash
if [ ! -f .env ]
then
export $(cat .env | xargs)
fi
@smebyp1
smebyp1 / 1_simpleFieldTags.go
Last active May 23, 2022 16:10 — forked from sosedoff/1_simple.go
Golang Custom Struct Tags Example
package main
import (
"fmt"
"reflect"
)
// Name of the struct tag used in examples
const tagName = "validate"
@smebyp1
smebyp1 / logging.go
Created March 10, 2022 20:49 — forked from panta/logging.go
zerolog with file log rotation (lumberjack) and console output
package logging
import (
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"gopkg.in/natefinch/lumberjack.v2"
"os"
"path"
"io"
)
@smebyp1
smebyp1 / revert-a-commit.md
Created September 8, 2021 14:14 — forked from gunjanpatel/revert-a-commit.md
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}'

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

@smebyp1
smebyp1 / vmq-admin
Last active May 26, 2021 15:21
Vernemq Commands
# Cleans up all offline sessions
vmq-admin session show --client_id --is_online --offline_messages | grep false | awk -F'|' '{print $2}' | xargs -I % vmq-admin session disconnect client-id=% --cleanup
# Check subscriptions
vmq-admin session show --topic --client_id | grep $CLIENT | awk -F '|' '{print $3}'
# Check Broker Metrics
vmq-admin metrics show
vmq-admin metrics show | grep message # Shows just the message metrics
@smebyp1
smebyp1 / redis.go
Last active May 24, 2021 14:09
Measure preformance in Go
// This redis package returns a connection object that isn't really concurrent safe, so we need to leverage
// Connection pooling to get its own connection when a thread needs to do something.
package main
import (
"fmt"
"log"
"github.com/gomodule/redigo/redis"
)