I wanted to test the status of my Dropbox client from the terminal. Actually, I wanted to write a script that executes an action when my Dropbox folder is fully synced. So I wanted to test the status if it’s “working” or “synced”.
I found the solution here. It turned out that Dropbox has an official command-line script that can do this and much more. First, get it:
wget -O ~/dropbox.py https://www.dropbox.com/download?dl=packages/dropbox.py chmod u+x ~/dropbox.py ~/dropbox.py status
This is a Python script, written in Python 2, thus I modified the first line to be “
This script can do several things for you:
$ dropbox.py Dropbox command-line interface commands: Note: use dropbox help to view usage for a specific command. status get current status of the dropboxd help provide help puburl get public url of a file in your dropbox stop stop dropboxd running return whether dropbox is running start start dropboxd filestatus get current sync status of one or more files ls list directory contents with current sync status autostart automatically start dropbox at login exclude ignores/excludes a directory from syncing lansync enables or disables LAN sync
Some years ago I wrote a simple script to get the public URL of a file in my Dropbox folder. This script can do that too with the “puburl” command.
There is a command line interface for Reddit called “rtv” (reddit terminal viewer). It’s written in Python, so you can install it with
Here is a short youtube video on how to use it.
You have a video and you want to create an animated gif from a part of it.
from moviepy.editor import * clip = (VideoFileClip("frozen_trailer.mp4") # input video .subclip((1,22.65),(1,23.2)) # part to extract, where 1’22.65 means 1 minute 22.65 seconds .resize(0.3)) # resize to 30% of the original clip.write_gif("use_your_head.gif") # output animated gif
Example 2 (cropping):
kris_sven = (VideoFileClip("frozen_trailer.mp4") .subclip((1,13.4),(1,13.9)) .resize(0.5) .crop(x1=145,x2=400)) # cropping: remove left-right borders
Example 3 (play forward and backward):
def time_symetrize(clip): return concatenate([clip, clip.fx( vfx.time_mirror )]) clip = (VideoFileClip("frozen_trailer.mp4", audio=False) .subclip(36.5,36.9) .resize(0.5) .crop(x1=189, x2=433) .fx( time_symetrize )) # the effect is added here
For more advanced usage, see the original blog post.
I have a desktop machine at home with a Windows 2007 virtual machine. I mainly have it because of Powerpoint. Recently I prefer to work on my laptop in the living room. Today I needed Powerpoint, so I decided to copy the whole Windows virtual machine and put it on my laptop. The only problem is that it was 67 GB and I didn’t have that much space on my external HDDs :(
Don’t panic. On my desktop machine I entered the folder that I wanted to copy and started a web server:
python -m SimpleHTTPServer
ifconfig” I checked the local IP address of the machine, it was
On my laptop I opened a browser and navigated to “
http://192.168.0.53:8000“. All the files I needed were there. Since I’m lazy and I didn’t want to click on each link one by one, I issued the following command (tip from here):
wget -r --no-parent http://192.168.0.53:8000
The download speed was about 10 MB/sec, so it took almost 2 hours.
You have a media file (audio, video, image) and you want to get some detailed information about it: duration, bit rate, resolution, etc. How to extract these pieces of information?
Use the MediaInfo project. You can install it via your package manager and you will get a command called “mediainfo”.
$ mediainfo movie.avi
General Complete name : movie.avi Format : AVI Format/Info : Audio Video Interleave Format profile : OpenDML Format settings : rec File size : 1.27 GiB Duration : 2h 29mn Overall bit rate : 1 218 Kbps Writing application : AVI-Mux GUI 188.8.131.52, Feb 16 201019:42:50 Video ID : 0 Format : MPEG-4 Visual Format profile : Advanced Simple@L5 Format settings, BVOP : 2 Format settings, QPel : No Format settings, GMC : No warppoints Format settings, Matrix : Default (H.263) Muxing mode : Packed bitstream Codec ID : XVID Codec ID/Hint : XviD Duration : 2h 29mn Bit rate : 1 086 Kbps Width : 720 pixels Height : 304 pixels Display aspect ratio : 2.35:1 Frame rate : 23.976 fps Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Compression mode : Lossy Bits/(Pixel*Frame) : 0.207 Stream size : 1.13 GiB (89%) Writing library : XviD 64 Audio ID : 1 Format : MPEG Audio Format version : Version 1 Format profile : Layer 3 Mode : Joint stereo Mode extension : MS Stereo Codec ID : 55 Codec ID/Hint : MP3 Duration : 2h 29mn Bit rate mode : Constant Bit rate : 128 Kbps Channel(s) : 2 channels Sampling rate : 48.0 KHz Compression mode : Lossy Stream size : 136 MiB (11%) Alignment : Aligned on interleaves Interleave, duration : 747 ms (17.92 video frames) Interleave, preload duration : 216 ms Title : mp3 Writing library : LAME3.99r Encoding settings : -m j -V 4 -q 2 -lowpass 17 -b 128