Coder Social home page Coder Social logo

trendiest's Introduction

Trendiest

Trendiest is a simple daemon that watches directories and manages a symlink named 'latest' which always points to the most recently modified file in the directory. This is useful for pointing at your Downloads or screenshots folder.

Examples:

# Download powerpoint presentation

libreoffice ~/Downloads/latest
# Take screenshot

feh ~/Pictures/latest
# insert usb stick
# Download ubuntu iso 
sudo dd if=~/Downloads/latest of=/dev/sdb # Probably don't actually do this

Details

Trendiest uses inotify to get file events. It fires once the file has been closed for writing. It uses a new symlink and a move operation to atomically replace the target symlink. There shouldn't be any race conditions but YMMV.

Installation

Unfortunately, the state of inotify python libraries is not great. There is an old unmaintained version packaged for debian, and a new unpackaged version on pypi. My solution to this is to create a virtualenv for the daemon and run it out of there with systemd.

cd local
git clone https://github.com/nibalizer/trendiest
cd trendiest/
virtualenv --python=python3 venv
source venv/bin/activate
pip install -r requirements.txt 
cp example_config.yaml config.yaml
vim config.yaml # make whatever modifications
vim contrib/trendiest.service # make whatever modifications to make yours work
sudo cp contrib/trendiest.service /etc/systemd/system/
systemctl daemon-reload 
sudo systemctl start trendiest.service
sudo systemctl status trendiest.service

# optional 
sudo systemctl enable trendiest.service

Name

This daemon keeps the latest file easy to get at with a symlink, so you could say it's very trendy. Or maybe the trendiest. Yeah.. it's bad. Names are hard ok.

trendiest's People

Contributors

nibalizer avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.