Skip to content

Instantly share code, notes, and snippets.

@renoirb
Last active January 30, 2024 06:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renoirb/8144234f6878ca9a50df622fc8a1451a to your computer and use it in GitHub Desktop.
Save renoirb/8144234f6878ca9a50df622fc8a1451a to your computer and use it in GitHub Desktop.
Now that I no longer use computer full time every day. Linux, files and Vim notes, because I can't remember all commands by heart

Delete every lines containing "DS_Store"

:g/DS_Store/d

Delete every line NOT containing "DS_Store"

:v/DS_Store/d

Manipulate images

Using imagemagick

brew install imagemagick

Convert HEIC to JPG

magick mogrify -monitor -format jpg  *.HEIC

Stack images up on top of the other

See ImageMagick convert

magick convert \ 
       -append  \
       IMG_2156.PNG \
       IMG_2157.PNG \
       IMG_2158.PNG \
       APPENDED_ON_TOP_OF_EACH_OTHER.png

Convert VBOX to OVA

Virtual Box images into Open Virtualization Format, VirtualBox can do that.

brew install virtualbox

VBoxManage clonemedium \
    <uuid | source-medium> \
    <uuid | target-medium> \
    [disk | dvd | floppy] \
    [--existing] \
    [--format= VDI | VMDK | VHD | RAW | other ] \
    [--variant=Standard,Fixed,Split2G,Stream,ESX]

Conversion

VBoxManage \
       clonemedium \
       kali-linux-2023.2-virtualbox-amd64.vdi \
       kali-linux-2023.2-virtualbox-amd64.ova

Generate random password

Usage: pwgen [ OPTIONS ] [ pw_length ] [ num_pw ]

Options supported by pwgen:
  -c or --capitalize
	Include at least one capital letter in the password
  -A or --no-capitalize
	Don't include capital letters in the password
  -n or --numerals
	Include at least one number in the password
  -0 or --no-numerals
	Don't include numbers in the password
  -y or --symbols
	Include at least one special symbol in the password
  -r <chars> or --remove-chars=<chars>
	Remove characters from the set of characters to generate passwords
  -s or --secure
	Generate completely random passwords
  -B or --ambiguous
	Don't include ambiguous characters in the password
  -h or --help
	Print a help message
  -H or --sha1=path/to/file[#seed]
	Use sha1 hash of given file as a (not so) random generator
  -C
	Print the generated passwords in columns
  -1
	Don't print the generated passwords in columns
  -v or --no-vowels
	Do not use any vowels so as to avoid accidental nasty words

Rename files too long or with different encoding

See Detox

❯ detox -h
usage: detox [-hLnrvV] [-f configfile] [-s sequence] [--dry-run] [--inline] [--special]
	  file [file ...]

	-f configfile	choose which config file to use
	-h --help	this message
	--inline	run inline mode
	-L		list available sequences and exit
			with -v ... dump sequence contents
	-n --dry-run	do a dry run (don't actually do anything)
	-r 		be recursive (descend into subdirectories)
	--remove-trailing (deprecated)
			remove trailing _ and - before a period
	-s sequence	choose which sequence to detox with
	--special	work on links and special files
	-v 		be verbose
	-V 		show the current version

To change files

detox -r --dry-run .

...

./2024-03_Tax_report/Transactions de mandats - Dossier Boulanger.xls -> ./2024-03_Tax_report/Transactions_de_mandats-Dossier_Boulanger.xls
./2024-01_Reading_Guillaume_Dulude/Dulude-141-154--energie.pdf -> ./2024-01_Reading_Guillaume_Dulude/Dulude-141-154-energie.pdf
./WIP_Home_network/Setting up VPN routes -> ./WIP_Home_network/Setting_up_VPN_routes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment