Skip to content

Instantly share code, notes, and snippets.

@CyberSecutor
Last active February 6, 2025 09:29
Show Gist options
  • Save CyberSecutor/72e9df46b7e0e4a4a62bac87c254de27 to your computer and use it in GitHub Desktop.
Save CyberSecutor/72e9df46b7e0e4a4a62bac87c254de27 to your computer and use it in GitHub Desktop.
Usefull bash scripts/commands

This file has some usefull commands in bash that I may need again.

Download all images from a list and put them in a directory structure following the URL path:

$ for i in `cat ~/imageList-karrepad.txt`; do echo $i | perl -e 'while (<>) {chomp $_; $url = $_; $path = $url; $path =~ s/.*\:\/\/(.*)\?.*/$1/g; system ("mkdir -p `dirname $path` 2> /dev/null") == 0 or die "failed to create $path. exiting...\n"; print "$url -O $path\n"; }' | xargs wget; done

Alternative for when the 'tree' command is not available

find . -maxdepth 2 -type d | sort -n | sed -e "s/[^-][^\/]*\// |/g" -e "s/|\([^ ]\)/|-\1/"

Ubuntu setup:

Filemanager: Nemo

Gnome Extentions:

  • Astra monitor
  • Clipboard history
  • gTile

MacOS X Virtualization with QuickEmu:

https://github.com/quickemu-project/quickemu

Flameshot - screen capture

To make it work with Wayland (Ubuntu 22.04+) take these steps to get it authorized:
  • Open the flameshot
  • Right click the flameshot icon on top right bar
  • do NOT click "Take Screenshot" yet
  • Click "Configuration" instead
  • With the flameshot configuration window opened, click the flameshot icon again on top right bar, this time click the "Take Screenshot", voila!
  • An authorization popup should show

If you restart your computer, then you have to redo the above steps.

Use PrtScr for flameshot:

  • Install flameshot: sudo apt install flameshot

  • Release the PrtScr binding by this command:

    • Ubuntu 19.10 (Credits: @jobou's comment) gsettings set org.gnome.settings-daemon.plugins.media-keys screenshot '[]'
    • Older Ubuntu versions: gsettings set org.gnome.settings-daemon.plugins.media-keys screenshot ''
  • Set new custom binding: gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/']"

  • Set name: gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ name 'flameshot'

  • Set command: gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ command '/usr/bin/flameshot gui'

  • Set binding: gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ binding 'Print'

iNotify

sudo sh -c 'echo "fs.inotify.max_user_watches = 2097152" > /etc/sysctl.d/inotify-limit.conf'
sudo sysctl -p --system
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment