Skip to content

Instantly share code, notes, and snippets.

View nirgeier's full-sized avatar

Nir Geier nirgeier

  • CodeWizard
  • Israel
  • 09:46 (UTC +03:00)
View GitHub Profile
@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"
Acai
Aceola
Alfalfa Sprouts
Apple
Apricot
Apricots
Artichoke
Asian Pear
Asparagus
Atemoya
@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
@nirgeier
nirgeier / Delete all facebook members (all the one visible on a given page)
Last active July 27, 2020 08:25
Delete all facebook group members on a given page. Usage: Copy this script, open developers console (F12) in chrome (win) and paste this script. The script will delete all the members that you can see in the given page. Once the script is done you should see a blank members page,
/**
* This script will delete all group members which are displayed in a given page.
*
* @author: Nir Geier
*
* Usage:
* Load as many users as you need, then open console and paste this script in teh console.
* Once the script finished executing you will be see blank members page, reload the next
* page and start the process again.
*
# 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;;