Table of Contents

cscredits

About cscredits

The cscredits system is designed to easily split the cost of an equally-shared resource. It was originally created for the poundcs.org VPS, where all users of the server pay an equal chunk of the monthly fee. Before cscredits, the per-user rate was calculated every 3 months, but this limited the time frames during which new people could join without complicating the monetary situation. The cscredits system solves this problem by keeping track of deposits made by users and calculating, for each day since they joined, their per-user cost determined by the number of users on the system and the monthly cost on that day.

For example, if 4 users are sharing a resource which costs $30 per month, they will each pay ($30)/(4 people)/(30 days) = $0.25 per day. Suppose, then, a 5th user shows up. Starting the day the new user joins, all five users will pay ($30)/(5 people)/(30 days) = $0.20 per day. The cscredits system calculates everything on the fly, storing only join/leave dates of users and monthly costs in its SQLite database.

Thus, the cscredits system has helped significantly with managing how much each user needs to pay for his or her equal share without the hassles of manual bookkeeping. As a convenient side effect, it helps scale by being able to increase users at any time at almost zero cost in cost-managing maintenance: new users simply make a reasonable deposit and get added to the system.

Here is a sample output:

user: kevin
joined: 2008-03-27

total deposited: $23.67
deposits:
  2008-03-27  $9.41
  2008-05-30  $14.26

users: 13
overall monthly rate: $38.00/month
per-user rate: $2.92/month ($0.10/day)

balance: $16.67 (about 5.7 months)

cscredits will print out the information for the user executing the program, or for a specified user with -u parameter.

Downloading

cscredits lives in a git repository. You can check it out with:

git clone http://quadpoint.org/git/cscredits

and update with:

git pull

from within the cscredits directory.

Bugs

Right now the cscredits system is pretty rudimentary with respect to data management. The code that manages adding/removing/updating users and deposits and monthly costs isn't written. Instead, deposits and users are added through copy-pasting the output of a couple simple Perl scripts that print out the necessary SQLite statements. :)

Overall, it's a very simple, yet very useful system for sharing a service over n people.