Skip to content

Instantly share code, notes, and snippets.

View nirgeier's full-sized avatar

Nir Geier nirgeier

  • CodeWizard
  • Israel
  • 07:37 (UTC +03:00)
View GitHub Profile
@nirgeier
nirgeier / bash-colors.sh
Last active May 11, 2024 11:44
bash-colors.sh
#!/bin/bash
# Reset
COLOR_OFF='\033[0m' # Text Reset
# Regular Colors
Black='\033[0;30m' # Black
Red='\033[0;31m' # Red
Green='\033[0;32m' # Green
Yellow='\033[0;33m' # Yellow
@nirgeier
nirgeier / limactl_fix_docker.sh
Last active April 7, 2024 20:44
Fixing limactl mount on MacOs
# Place the file under ~/.lima/_config/override.yaml
cat << EOF > ~/.lima/_config/override.yaml
---
mounts:
- location: "/tmp"
writable: true
- location: "~/"
writable: true
EOF
@nirgeier
nirgeier / vim.MD
Last active March 22, 2024 09:04
Vim Useful shortcuts

Vim Useful shortcuts

Delete all content of the file (empty file)

ESC + gg + dG

So, how does this dG command works?

  • gg - Jump to the first line of the file
  • dg - d is for the cut action and G is for moving the cursor to the end of the file.
  • This way, dG cuts all the text from the current cursor position to the end of the file.

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

@nirgeier
nirgeier / main.yaml
Created November 27, 2023 21:02 — forked from kbariotis/main.yaml
Ansible playbook for deploying a Node.js app to DigitalOcean
- name: DO
hosts: localhost
vars:
project_name: "PUT A NAME FOR YOUR PROJECT HERE"
do_token: "PUT YOUR DIGITAL OCEAN API KEY HERE ==> https://cloud.digitalocean.com/settings/api/tokens"
repository: "PUT YOUR REPOSITORY URL HERE"
tasks:
- name: LOCAL | Generate SSH key
shell: ssh-keygen -b 2048 -t rsa -f ~/.ssh/{{project_name}} -q -N ""
@nirgeier
nirgeier / sample_replacement.sh
Created October 25, 2022 09:43
Replace text (ex: server url) in AzureDevOps comments
##
## Global variables
##
# The string which we wish to replace
STR_TO_REPLACE="STR_TO_REPLACE"
# The new value
STR_REPLACMENT="New Server URL"
@nirgeier
nirgeier / install.sh
Created February 27, 2021 11:28 — forked from rexlow/install.sh
Enable zsh in Gcloud shell
##
# This is an adoption from Oh My Zsh for Google Cloud Shell
# author - bobvanluijt
# source - https://github.com/bobvanluijt/google-cloud-shell-pro-zsh
##
main() {
# Install zsh
sudo apt-get -qq update
@nirgeier
nirgeier / get-latest-tag-on-git.sh
Created October 7, 2020 14:46 — forked from rponte/get-latest-tag-on-git.sh
Getting latest tag on git repository
# The command finds the most recent tag that is reachable from a commit.
# If the tag points to the commit, then only the tag is shown.
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object
# and the abbreviated object name of the most recent commit.
git describe
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix:
git describe --abbrev=0
# other examples
# without `:` the values are optionals
while getopts abc flag;
do
case "${flag}"
in
a ) echo $optarg ; pa="$OPTARG"; echo $pa;;
b ) pb=${OPTARG};;
c ) pc=${OPTARG};;
\?) echo "Invalid option: kubde" 1>&2 ;;
: ) echo "Invalid option: $OPTARG requires an argument" 1>&2;;
@nirgeier
nirgeier / gitbash-az
Created April 28, 2020 21:36
Add az command to Git-bash
# Add az (Azure cli) to git bash
echo "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14} ${15} > "%USERPROFILE%\AppData\Local\Programs\Git\mingw64\bin\az"