Showing posts with label bash. Show all posts
Showing posts with label bash. Show all posts
Sunday, 16 October 2022

screenFetch - The Bash Screenshot Information Tool

I had been seeing this image everywhere but had no idea how to create it. Simple, a little application called Screenfetch is the answer to that question.
ScreenFetch is a system information tool that was created primarily for Bash Shell, while it can also work in other shell environments.
The programme will identify the Linux distribution you are using and create an ASCII version of the distribution's logo with some useful information to the right of the logo. The tool is very configurable; options include changing colours, disabling ASCII, and taking screenshots when information is shown.

Start by open a teminal Ctrl Alt T

Now you can install from the official repositories
apt install screenfetch

I also came across a comparable programme called neofetch while writing this, that is (in my experience) much faster.

apt install neofetch

I believe I'll stick with that one, but you should obviously make your own decision.
Wednesday, 10 November 2021

Command line upload to Dropbox

Dropbox OAuth Guide
It is sometimes useful to upload a file or files to Dropbox from the terminal or even by script. This snippet uploads a file to the directory's root.
 
curl -X POST https://content.dropboxapi.com/2/files/upload --header "Authorization: Bearer <Auth code> " --header "Dropbox-API-Arg: {\"path\": \"/filename.png\",\"mode\": \"add\",\"autorename\": true,\"mute\": false,\"strict_conflict\": false}" --header "Content-Type: application/octet-stream" --data-binary @filename.png
Wednesday, 8 January 2014

Timelapse with Rapberry Pi camera module

As I have mentioned before I always wanted the camera module for the Raspberry Pi. Until now I had only tried out timelapse using my laptop web camera, and that gave me really crappy images. Now I have the camera module to play with and the images are way better. This is timelapse from 12:00 31. Des 2013 to 12:00 1. Jan 2014 shows 24 Hours in 5 minutes and 26 sec. including some fireworks.



This script will take image every 5 seconds 1440 times leaving you with just enough to create 60 sec timelaps video using 24 fsp

#!/bin/bash
# Timelapse controller for USB webcam
DIR=/home/user/timelapse
x=1
while [ $x -le 1440 ]; do                                                       
filename=$(date -u +"%Y%m%d-%H%M-%S").jpg                                       
raspistill -o $DIR/$filename -w 1280 -h 960 -n -t 1000
x=$(( $x + 1 ))
sleep 5;
done

Now you have 1440 images or the number you entered and next step is to create the video. Copy the images to your computer using scp or rsync, you can add that to your script if the Raspberry pi is connected to network. When you have all your images on your computer you can render video with mencoder. Install mencoder if needed.

sudo apt-get install mencoder

#!/bin/bash
DIR=/home/user/timelapse/
ls $DIR/*.jpg > list.txt
mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:aspect=16/9:vbitrate=8000000 -vf scale=640:480 -o $DIR/$(date -u +"%Y%d%m-%H%M-%S").avi -mf type=jpeg:fps=24 mf://@list.txt
rm list.txt

All ideas about improving this code are welcome.
-cheers