Publish to local Maven repository

plugins {
 id 'java-gradle-plugin'
 id 'maven-publish'
gradlew publishToMavenLocal -Pversion=wip

Add local Maven repository for plugins

in settings.gradle

pluginManagement {
 repositories {



Jobs are processes which are started by a shell.

  • CTRL+Z suspends the current foreground job.
  • bg executes job in background.
  • jobs lists background jobs.
  • fg brings job to foreground.
  • kill %2 kills background job with job number 2.

Monitor Processes

  • top or htop finds processes
  • ps aux | grep java finds java processes


Git clone including submodules

git clone --recursive [URL to Git repo]

Load submodules in already cloned repo

git submodule update --init --recursive

Pull all changes in the repo including changes in the submodules

git pull --recurse-submodules

Pull all changes for the submodules

git submodule update --remote


Sync all files in a directory to another directory on the same machine

rsync -avzh /root/rpmpkgs /tmp/backups/

Sync all files in a directory to another machine

rsync -avz rpmpkgs/ [email protected]:/home/

Copy/Sync a Remote Directory to a Local Machine

rsync -avzh [email protected]:/home/tarunika/rpmpkgs /tmp/myrpms

Copy a File from a Remote Server to a Local Server with SSH

rsync -avzhe ssh [email protected]:/root/install.log /tmp/

Copy a File from a Local Server to a Remote Server with SSH

rsync -avzhe ssh backup.tar [email protected]:/backups/


How disable password authentication so you don’t have to type password

every time you want to install something

How to fix broken sudo - sudo: parse error in /etc/sudoers near line X

Use pkexec

pkexec vi /etc/sudoers/...

Running pkexec without a graphical agent fails even with falling back onto pkttyagent

running pkexec gives something like:

polkit-agent-helper-1: error response to PolicyKit daemon: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: No session for cookie
Error executing command as another user: Not authorized


Note that to make it work, run pkttyagent in a different terminal binding to

the PID of the first terminal that is running pkexec.

In the first terminal run the following command to get its PID.

echo $$

In the second terminal run

pkttyagent --process PID_FROM_STEP_1

In the first terminal, do whatever you need to do with pkexec.


How to quickly setup a static file server.

Node / Npm

npm install http-server -g

To use it:

cd D:\Folder

Or, like this:

http-server D:\Folder


python -m SimpleHTTPServer


python3 -m http.server


create file web-server.go

package main

import (

func ping(w http.ResponseWriter, r *http.Request) {

func main() {
  http.Handle("/", http.FileServer(http.Dir("./public")))
  http.HandleFunc("/ping", ping)
  fmt.Printf("listening on port 8080\n");
  if err := http.ListenAndServe(":8080", nil); err != nil {


go run web-server.go


docker-compose up
docker-compose down
docker-compose logs -f
docker-compose logs -f [service] (service is not same as container, look in compose file for service names)


Go inside a running container

docker exec -it <containerIdOrName> bash (or /bin/bash or /bin/ash)

Look inside an image

docker run -it --entrypoint /bin/bash <imageid>

Stop and remove all docker containers and images

Stop all running containers

docker stop $(docker ps -aq)

Remove all containers

docker rm $(docker ps -aq)

Remove all images

docker rmi $(docker images -q)


docker [image,container,volume,..] prune -a


Dead simple wildcard DNS for any IP Address

Stop editing your etc/hosts file with custom hostname and IP address mappings. Dead simple wildcard DNS for any IP Address

  • maps to

  • maps to maps [.-] in “dot”, “dash” or “hexadecimal” notation to the corresponding :


Copy, Cut, Paste

yy - Yank (copy) the current line, including the newline character. 3yy - Yank (copy) three lines, starting from the line where the cursor is positioned.

dd - Delete (cut) the current line, including the newline character. 3dd - Delete (cut) three lines, starting from the line where the cursor is positioned.

p - Paste

How to map save to Ctrl+s

Why? To avoid freezing the terminal by mistake.

in .vimrc

noremap <silent> <C-S>          :update<CR>
vnoremap <silent> <C-S>         <C-C>:update<CR>
inoremap <silent> <C-S>         <C-O>:update<CR>

in .bashrc or .zshrc

stty -ixon

When VIM is frozen, don’t accept input, and you can’t close it?

Probably you did Ctrl+S by mistake - it freezes your terminal, type Ctrl+Q to get it going again.



Fullscreen toggle with Ctrl + Command + F Move between desktops and/or fullscreens Ctrl + -> Ctrl + <- How to force an app to quit on your Mac Option + Command + Esc Or choose Force Quit from the Apple () menu in the upper-left corner of your screen. How to take a screenshot on your Mac Shift + Command + 3 -> the whole screen Shift + Command + 4 -> a portion of the screen Shift + Command + 4 + Space -> a window in the screen Function-Delete to forward delete Fn + Delete -> deletes the character to right of the cursor Control + D -> deletes the character to right of the cursor Command + Delete -> deletes whole word Option + Delete -> deletes whole word Lock screen Shift + Command + Q Open new tab (in browser, iterm, …) Command + T Switch to next/previous tab (in browser, iterm, …) Ctrl + Tab, Ctrl + Shift + Tab Command + 1, Command + 2 -> Switch to tab 1 and then tab 2 (works for the first 8 tabs) [Read More]



Problem booting ubuntu

[ 3.516984] bcma: Unsupported SPROM revision: 11 [ 3.517071] bcma: bus0: No SPROM available

  • add nomodset to boot params (between quiet and splash)

Problem installing GRUB2 (grub-efi-amd64-signed failed installation /target/)

  • you need to ensure that a partition of the ‘EFI system partition’ type is mounted at /boot/efi
  • disable secure boot in UEFI BIOS

*** Problem = no wireless

dmesg shows Broadcom 4352 WLAN found ERROR: FOUND UNSUPPORTED PHY

sudo update && sudo apt-get install bcmwl-kernel-source

*** install NVIDIA drivers

ubuntu-drivers devices
sudo ubuntu-drivers autoinstall

Window manager shortcuts

Alt+F7 for maximizing windows (both vertically and horizontally) Alt+Space for the window operations menu

grab and move key

Alt + left mouse button


Find all .jpg files in the /home and sub-directories

find /home -name *.jpg

Find an empty file within the current directory

find . -type f -empty

Find all .db files (ignoring text case) modified in the last 7 days by a user named exampleuser

find /home -user exampleuser -mtime -7 -iname ".db"

Find and Process Files

find . -name "*.txt" -exec chmod o+r '{}' \;

Find and Delete Files

find . -name "*.bak" -delete
linux  shell 


SSH Port forwarding

-L Specifies that the given port on the local (client) host is to be forwarded to the given host and port on the remote side.

ssh -L 9200:localhost:9200 [email protected]