Skip to content

Instantly share code, notes, and snippets.

Glenn Dixon dixonge

View GitHub Profile
@dixonge
dixonge / VSCode-Regex-Search-Replace-Markdown-Images
Last active Apr 2, 2020
Regex to find markdown images and replace with img tag in VS Code (or template engine shortcode, etc.)
View VSCode-Regex-Search-Replace-Markdown-Images
Find: !\[(.*?)\]\((.*?)\)
Replace: <img alt="$1" src="$2">
@dixonge
dixonge / Download-articles-from-paywalled-sites
Created Apr 2, 2020
Download articles from even paywalled web sites (like Medium or Wired)
View Download-articles-from-paywalled-sites
wget -m -np --page-requisites --adjust-extension --convert-links <web site link>
@dixonge
dixonge / VS-Code-Regex-find-line-beginning-with-specific-text-append-end-of-line
Created Apr 2, 2020
VS Code Regex to find line beginning with specific text and append to end of line
@dixonge
dixonge / Rename-folders-moving-date-from-end-to-beginning-of-folder-name
Created Apr 2, 2020
Rename folders by moving date from end to beginning of folder name
View Rename-folders-moving-date-from-end-to-beginning-of-folder-name
rename -v -- 's/^(.*)-(\d{4})-(\d{2})-(\d{2})/$2-$3-$4-$1/' *
@dixonge
dixonge / Rename-photos-name-original-date-timestamp
Last active Apr 2, 2020
Rename photos with name followed by original file date/timestamp using exiftool
View Rename-photos-name-original-date-timestamp
exiftool '-filename<file-name-text-goes-here-$CreateDate' -d %Y-%m-%d_%H-%M-%S%%-c.%%le *.jpg
@dixonge
dixonge / Set-photo-title-description-exiftool
Created Apr 2, 2020
Set photo title and description with exiftool
View Set-photo-title-description-exiftool
exiftool -title='Title goes here' -description='Description goes here' .
@dixonge
dixonge / Kernel-customization-Elan-touchpad-Lenovo-Ideapad-330-Ubuntu18.04
Created Apr 2, 2020
Kernel customization to enable Elan touchpad on Lenovo Ideapad 330 w/ Ubuntu 18.04
View Kernel-customization-Elan-touchpad-Lenovo-Ideapad-330-Ubuntu18.04
#ifdef CONFIG_ACPI static const struct acpi_device_id elan_acpi_id[] = {
{ "ELAN0000", 0 },
{ "ELAN0100", 0 },
{ "ELAN0600", 0 },
{ "ELAN0602", 0 },
{ "ELAN0605", 0 },
{ "ELAN0608", 0 },
{ "ELAN0609", 0 },
{ "ELAN060B", 0 },
{ "ELAN060C", 0 },
@dixonge
dixonge / Extract-Title-Description-from-flickr-json
Created Apr 2, 2020
Extract Title and Description from json file and write it to jpg file after downloading from Flickr using Flickr Downloadr
View Extract-Title-Description-from-flickr-json
for jpg in *.jpg; do exiftool -json=$jpg.json $jpg; done

@dixonge
dixonge / Rename-files-all-subdirectories
Last active Apr 2, 2020
Rename files in all subdirectories. . If the file name is the same, just use filename instead of 'pattern.ext' - if the file names are different, use a pattern like '*.md'
View Rename-files-all-subdirectories
find . -iname pattern.ext -exec rename 's/oldname/newname/' '{}' \;
@dixonge
dixonge / Delete-line-only-if-blank-in-all-files-in-folder
Created Apr 2, 2020
Delete a line only if blank in all files in a folder
View Delete-line-only-if-blank-in-all-files-in-folder
find ./ -type f -exec sed '1{/^$/d}' {} \;

You can’t perform that action at this time.