Git Product home page Git Product logo

fn's Introduction

FN (Python 3)

What is it?

This is a tiny library to generate file names.

It will give you unique file names based on current git commit, as well as the time and date. You can also set your own prefix and/or postfix.

When fn is called from the terminal, the file names look like this:

20160428-001056-597392-2d95c86-b775190
20160428-001056-153234-2d95c86-b775190

Which currently follows this format:

yyyymmdd-hhmmss-10^(-6)seconds-gitsha-proctimesha

Where gitsha is the prefix of the git commit sha. And proctimesha is a hash of the time when Fn() is called and the process id of the calling python script.

If you are not in a git repo, it looks like this:

20160428-001056-153234--b775190

If you use the package within python you can also:

  • Pass your own prefix and postfix.
  • Override the postfix.
  • Append incremental numbers.
  • Change the delimiter.
  • Override the length of the git sha.

Se ./example.py for some usage

Why?

I have a lot of projects where I make large amounts of files (images, 3D models, 2D vector files), and I've always wanted a more efficient way of maintaining unique file names.

I got inspired to write this when I saw this tweet about how Vera Molar names her works in a Periscope video:

https://twitter.com/inconvergent/status/700341427344113665

Install

Install using (as sudo) either

./setup.py install

Or

./setup.py develop

The latter is most convenient if you will be editing the code.

Does it guarantee unique file names in any way?

No. It only uses the current time to make a relatively distinct string—don't use this for anything remotely important.

fn's People

Contributors

inconvergent 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.