Skip to content

Instantly share code, notes, and snippets.

View asperduti's full-sized avatar
🏠
Working from home

Ariel Sperduti asperduti

🏠
Working from home
View GitHub Profile
@asperduti
asperduti / renameFilesByDate.sh
Last active March 11, 2018 12:41
Bash script to rename all the files with an extension(in this case, MP4). The new name is going to have the creation date.
for f in *.MP4; do mv -n "$f" "VID_$(date -r "$f" +"%Y%m%d_%H%M%S").mp4"; done
@asperduti
asperduti / renameImages.sh
Created March 11, 2018 12:42
Bash script to rename images. The new name is going to have the creation date that is in the metadata.
jhead -nIMG_%Y%m%d_%H%M%S *.JPG
@asperduti
asperduti / docx2md.md
Created April 10, 2018 22:57 — forked from aembleton/docx2md.md
Convert a Word Document into 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

exiftool "-datetimeoriginal<filename" -d "IMG_%Y%M%D-%H%M%S.%%e" ./
@asperduti
asperduti / changeHostname.sh
Created May 16, 2018 19:00
Customizing hostname for a network
nmcli con modify "NETWORK_NAME" ipv4.dhcp-hostname "CUSTOM_HOSTNAME"
@asperduti
asperduti / setDateCreated.sh
Last active June 10, 2018 18:04
Set date created/modified of a files in directory with the date in its name
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
#!/bin/bash
PROGNAME=${0##*/}
INPUT=''
QUIET='0'
NOSTATS='0'
max_input_size=0
max_output_size=0
usage()
@asperduti
asperduti / updateExifGPS.sh
Last active December 22, 2018 21:28
Bash command to set GPS metadata
exiftool -XMP:GPSLatitude=41.3825 -XMP:GPSLongitude=2.176944 -P -overwrite-original *.jpg
@asperduti
asperduti / single-page-app.html
Created May 3, 2020 00:35
This is an example to show how simple it can be to implement a Single Page App(SPA) and how to use AJAX to make a request to the server and how to use the HTML5 History API to manipulate the browser’s history. This example is taken from "CS50’s Web Programming with Python and JavaScript"
<html>
<head>
<script>
document.addEventListener('DOMContentLoaded', () => {
// Start by loading first page.
load_page('first');
// Set links up to load new pages.
document.querySelectorAll('.nav-link').forEach(link => {
@asperduti
asperduti / How to stream to Facebook Live with FFmpeg.sh
Last active October 13, 2021 17:33
Command-line to stream to Facebook live with FFmpeg. Specifications for Live on Facebook: https://www.facebook.com/business/help/162540111070395?id=1123223941353904
ffmpeg -re -y -i input_file.mp4 -c:a copy -ac 1 -ar 44100 -b:a 96k -vcodec libx264 -pix_fmt yuv420p -vf scale=1080:-1 -r 30 -g 60 -tune zerolatency -f flv -maxrate 2000k -preset veryfast "rtmps://live-api-s.facebook.com:443/rtmp/$KEY"