Monday 30 October 2023

File upload / embed example

 Here's how we share a file on a blog.

Here's a file . Here' the link again 

 
  Linking a PDF document from Google Drive 

Select the PDF file you want to embed. 

Right click -> Preview -> More actions -> Open in a new window. 

Now click More actions -> Embed item. 

Copy the embed code and paste it on your blog post. Make sure the file is publicly available.

Code Sample

<iframe allow="autoplay" height="480" src="https://drive.google.com/file/d/10M0Ptz6Jw-ZIcRGvFhaqQ8MtKItyb2jP/preview" width="100%"> 

</iframe>

Automatic Backups in Linux

In an earlier post, a script for synchronizing data across different machines with the help of either a USB drive or a network was discussed. Here a different approach is presented (thanks to Resmi and Philip).

If one wants to backup only those files that were created/modified in the last 24 hrs, the following script can be used


#!/bin/bash
BACKUP_DIR=`date +%d‑%b‑%G`
mkdir ~/Desktop/$BACKUP_DIR
for file in `find $HOME -mtime 0 \! -wholename "*/.*"`
do 
cp -i $file ~/Desktop/$BACKUP_DIR
done

This will copy the files that were modified in the last 24 hrs from the user's home folder and sub-folders, except the hidden ones, to a folder on the Desktop named by current date, say 29-Feb-2012.