Skip to content

Instantly share code, notes, and snippets.

@apzentral
apzentral / start.sh
Created August 10, 2024 19:07
tmux script to generate multiple windows
#!/bin/bash
SESSION="app"
PROJECT_PATH="~/projects/app"
cd $PROJECT_PATH
tmux new-session -d -s $SESSION
tmux rename-window -t 1 'backend'
tmux new-window -t $SESSION:2 -n 'frontend'
tmux new-window -t $SESSION:3 -n 'backend-src'
@apzentral
apzentral / git-rm-branches.sh
Last active May 22, 2024 17:14
git script to remove all local branches that not exists in the remote
#!/bin/bash
# Fetch the latest changes from the remote and prune deleted branches
git fetch --prune
# Get a list of all local branches
local_branches=$(git branch --format='%(refname:short)')
# Get a list of all remote branches
remote_branches=$(git branch -r --format='%(refname:short)' | sed 's/origin\///')
@apzentral
apzentral / git-installer.sh
Last active November 29, 2022 09:19
Git installer
#!/usr/bin/env bash
VERSION=2.37.3
curl -o git.tar.gz "https://mirrors.edge.kernel.org/pub/software/scm/git/git-$VERSION.tar.gz"
tar -zxf git.tar.gz
cd "git-$VERSION"
make prefix=/usr/local all
sudo make prefix=/usr/local install
@apzentral
apzentral / java-installer.sh
Created July 18, 2022 02:46
Install java script
#!/usr/bin/env bash
JAVA_VERSION=jdk1.8.0_05
JAVA_FILE_NAME="jdk-8u5-linux-i586.tar.gz"
sudo tar xvzf "${JAVA_FILE_NAME}" -C /usr/java
JAVA_HOME="/usr/java/${JAVA_VERSION}/"
sudo update-alternatives --install /usr/bin/java java ${JAVA_HOME%*/}/bin/java 20000
sudo update-alternatives --install /usr/bin/javac javac ${JAVA_HOME%*/}/bin/javac 20000
@apzentral
apzentral / vim-installer.sh
Created July 18, 2022 01:50
Install vim script
#!/usr/bin/env bash
git clone https://github.com/vim/vim.git
cd vim
git pull
cd src
make distclean # if you build Vim before
make
sudo make install
@apzentral
apzentral / tmux-installer.sh
Last active July 18, 2022 01:48
Install tmux script
#!/usr/bin/env bash
TMUX_VERSION=3.3
sudo apt-get update
sudo apt-get install -y libevent-dev libncurses-dev make
wget "https://github.com/tmux/tmux/releases/download/${TMUX_VERSION}/tmux-${TMUX_VERSION}.tar.gz"
tar xvzf "tmux-${TMUX_VERSION}.tar.gz"
cd "tmux-${TMUX_VERSION}/"
./configure && make
sudo make install
@apzentral
apzentral / .gitconfig
Last active April 8, 2023 00:50
gitconfig
# INCLUDES
# --------
# Local/Private config goes in the include
[include]
path = ~/.gitconfig.local
[core]
editor = /usr/bin/vim
excludesFile = ~/.gitignore
longpaths = true
@apzentral
apzentral / .vimrc
Last active December 8, 2022 21:22
This is a basic vimrc file
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
@apzentral
apzentral / dk-network-all.sh
Created April 26, 2021 22:56
Docker check all subnet
# Need to install jq
docker network inspect $(docker network ls | awk '$3 == "bridge" { print $1}') | jq -r '.[] | .Name + " " + .IPAM.Config[0].Subnet' -
@apzentral
apzentral / .tmux.conf
Last active September 29, 2023 19:18
TMUX basic config using A instead of B
# remap prefix to Control + a
set -g prefix C-a
# bind 'C-a C-a' to type 'C-a'
bind C-a send-prefix
unbind C-b
# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'