Skip to content

Instantly share code, notes, and snippets.

View gturi's full-sized avatar

Giacomo Venturini gturi

View GitHub Profile
@gturi
gturi / maven-compiler-plugin.md
Created May 7, 2024 10:25
Nice configuration of maven compiler plugin

Nice configuration of maven compiler plugin

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.12.1</version>
            <configuration>
@gturi
gturi / override-global-git-config.md
Last active January 8, 2024 14:45
Override global git config for specific directories

Override global git config for specific directories

# gitconfig
[user]
  name = username
  email = [email protected]

[includeIf "gitdir:*/private-projects/*"]
 path = ~/.gitconfig-private
@gturi
gturi / glob-first-match-and-run.md
Created July 26, 2023 20:23
Match a file with a glob pattern and run it

Match a file with a glob pattern and run it

#!/bin/bash

cd "$(dirname "$0")" || exit

function run() {
  local pattern=$1
 local files=( $pattern )
@gturi
gturi / open-windows-terminal.ahk
Created June 29, 2023 12:27
Opens windows terminal using Ctrl+Alt+T
#Requires AutoHotkey v2.0
^!t::
{
Run "C:\Users\govn\AppData\Local\Microsoft\WindowsApps\wt.exe"
}

Lazy load bashrc scripts

nvm example

export NVM_DIR="$HOME/.nvm"

function loadNvm() {
  [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
}
@gturi
gturi / mount-android-device-over-ssh.md
Last active November 10, 2024 06:23
Mount an Android device on your pc filesystem over ssh

Mount an Android device on your pc filesystem over ssh

Install scrcpy

Scrcpy allows to send keyboard input to the device, its installation is recommended since typing commands in the terminal from Android's keyboard it is quite uncomfortable:

scrcpy -K
@gturi
gturi / bash-script-template.md
Last active May 7, 2023 09:03
Template for less error prone bash scripts

Bash script template

#!/bin/bash

set -o errexit
set -o nounset
set -o pipefail
if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace; fi
export SHELLOPTS

Useful npm commands

Test packages without deploying to npm registry

# create your local registry # I.E. $HOME/Desktop/local-npm
LOCAL_REGISTRY='/path/to/local-registry' # I.E. $HOME/Desktop/local-npm
mkdir "$LOCAL_REGISTRY"

cd '/path/to/your/program'

Useful maven commands

Specify jdk to use for running maven command

function mvn() {
   MVN_HOME=/home/gventurini/Programs/apache-maven-3.6.3/bin/mvn
   JAVA_HOME=/home/gventurini/.jdks/corretto-1.8.0_342 "$MVN_HOME" "$1"
}
@gturi
gturi / open-konsole.md
Created September 17, 2022 15:54
open konsole and run script if it was not started from konsole session

Open konsole and run script if it was not started from konsole session

This does not alter the script behaviour when running it directly in konsole with /path/to/script.sh

#!/bin/bash

tty -s || exec konsole -e "$0" "$@"

# script logic