Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Ariel Sperduti asperduti

View GitHub Profile
@asperduti
asperduti / updateExifGPS.sh
Last active Dec 22, 2018
Bash command to set GPS metadata
View updateExifGPS.sh
exiftool -XMP:GPSLatitude=41.3825 -XMP:GPSLongitude=2.176944 -P -overwrite-original *.jpg
View optimize.sh
#!/bin/bash
PROGNAME=${0##*/}
INPUT=''
QUIET='0'
NOSTATS='0'
max_input_size=0
max_output_size=0
usage()
@asperduti
asperduti / changeHostname.sh
Created May 16, 2018
Customizing hostname for a network
View changeHostname.sh
nmcli con modify "NETWORK_NAME" ipv4.dhcp-hostname "CUSTOM_HOSTNAME"
@asperduti
asperduti / setDateCreated.sh
Last active Jun 10, 2018
Set date created/modified of a files in directory with the date in its name
View setDateCreated.sh
for f in *.jpg; do filename=$(echo $f | cut -d'.' -f 1); date=$(echo $filename | cut -d'_' -f 2)$(echo $filename | cut -d'_' -f 3); date=$(echo $date | cut -c1-12);echo $date; touch -t $date "$f"; done
View updateExifDateWithFilename.sh
exiftool "-datetimeoriginal<filename" -d "IMG_%Y%M%D-%H%M%S.%%e" ./
@asperduti
asperduti / docx2md.md
Created Apr 10, 2018 — forked from aembleton/docx2md.md
Convert a Word Document into MD
View docx2md.md

Converting a Word Document to Markdown in One Move

The Problem

A lot of important government documents are created and saved in Microsoft Word (*.docx). But Microsoft Word is a proprietary format, and it's not really useful for presenting documents on the web. So, I wanted to find a way to convert a .docx file into markdown.

Installing Pandoc

On a mac you can use homebrew by running the command brew install pandoc.

The Solution

@asperduti
asperduti / renameImages.sh
Created Mar 11, 2018
Bash script to rename images. The new name is going to have the creation date that is in the metadata.
View renameImages.sh
jhead -nIMG_%Y%m%d_%H%M%S *.JPG
@asperduti
asperduti / renameFilesByDate.sh
Last active Mar 11, 2018
Bash script to rename all the files with an extension(in this case, MP4). The new name is going to have the creation date.
View renameFilesByDate.sh
for f in *.MP4; do mv -n "$f" "VID_$(date -r "$f" +"%Y%m%d_%H%M%S").mp4"; done
You can’t perform that action at this time.