Skip to content

Instantly share code, notes, and snippets.

View TonyWhite's full-sized avatar

TonyWhite

    View GitHub Profile
    @TonyWhite
    TonyWhite / gui_or_shell.sh
    Created January 14, 2022 12:00
    Detects whether the bash script is started from the GUI or the shell
    #!/bin/bash
    # Start from GUI?
    GUI=false
    if [[ $(readlink -f /proc/$(ps -o ppid:1= -p $$)/exe) != $(readlink -f "$SHELL") ]]; then
    GUI=true
    fi
    # Show message
    if [[ $GUI == true ]]; then
    @TonyWhite
    TonyWhite / HEIC.sh
    Created January 12, 2022 11:49
    Bulk convert HEIC images to Jpeg
    #!/bin/bash
    # OBJECTIVE
    # Bulk convert HEIC images to Jpeg
    # DEPENDENCIES
    # imagemagick
    # USAGE
    # 1) Put script in same folder of HEIC files
    @TonyWhite
    TonyWhite / array.sh
    Created October 25, 2020 09:54
    Array - gestire elementi con spazi
    #!/bin/bash
    # Aggiungo elementi in un vettore: stringhe con spazi.
    # Ho un vettore e ci aggiungo elementi contenenti spazi.
    tput clear
    echo "Creo un array vuoto"
    echo "LISTA=()"
    LISTA=()
    echo ""
    @TonyWhite
    TonyWhite / ssh-remote-folder.sh
    Last active April 20, 2020 13:40
    Connect to a remote SSH folder with Zenity without a password
    #!/bin/bash
    # Configuration
    REMOTE_USER="admin"
    REMOTE_IP="11.22.33.44"
    REMOTE_PORT="22"
    REMOTE_FOLDER="/data"
    LOCAL_FOLDER="/mnt/nas"
    LOCAL_KEY="~/.ssh/chiavi/nas" # Private key
    # Create private and public keys with ssh-keygen
    @TonyWhite
    TonyWhite / backlight
    Last active October 5, 2021 15:40
    Clevo XSM Keyboard's led
    #!/bin/bash
    # Backlight - Clevo XSM Keyboard's led
    # Copyright (C) 2019-2021 Antonio Bianco
    #
    # This program is free software: you can redistribute it and/or modify
    # it under the terms of the GNU General Public License as published by
    # the Free Software Foundation, either version 3 of the License, or
    # any later version.
    #
    @TonyWhite
    TonyWhite / zen-autoclick.sh
    Last active May 10, 2019 21:32
    Auto-click when Caps Lock ON
    #!/bin/bash
    # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
    # Version 2, December 2004
    #
    # Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
    #
    # Everyone is permitted to copy and distribute verbatim or modified
    # copies of this license document, and changing it is allowed as long
    # as the name is changed.
    @TonyWhite
    TonyWhite / homejar.desktop
    Created March 1, 2018 09:27
    HomeJar - Execute a jar file in Linux Home directory
    [Desktop Entry]
    Name=HomeJar
    Comment=Jar executor in Home directory
    Exec=homejar %f
    Icon=homejar.svg
    Terminal=false
    Type=Application
    Categories=Settings;System;
    StartupNotify=false
    MimeType=x-java-archive;
    @TonyWhite
    TonyWhite / DaemonFileSync.java
    Created October 6, 2012 12:54
    JDaemonFileSync
    /**
    * La classe è un demone che effettua la sincronizzazione dei file
    *
    * @author Antonio Bianco
    * creazione: 02/10/2012
    * ultima modifica: 03/10/2012
    */
    import java.io.File;
    import java.nio.file.Files;
    import static java.nio.file.StandardCopyOption.*;
    @TonyWhite
    TonyWhite / JClipboard.java
    Created September 22, 2012 06:10
    Parkinson
    import java.awt.datatransfer.*;
    import java.awt.*;
    public class JClipboard implements ClipboardOwner
    {
    /**
    * Incolla nella Clipboard
    */
    public void toClipboard(String contenuto)
    {
    @TonyWhite
    TonyWhite / JClipboard.java
    Created September 22, 2012 06:09
    MarioMouse
    import java.awt.datatransfer.*;
    import java.awt.*;
    public class JClipboard implements ClipboardOwner
    {
    /**
    * Incolla nella Clipboard
    */
    public void toClipboard(String contenuto)
    {