#!/bin/bash if [ "$#" -eq 0 ] || [ "$1" = "--help" ] || [ "$1" = "-h" ] then /bin/echo "Usage:" /bin/echo " ntcoin : to create tcoin subdirectories in with the executable saved to and with basecoins per user" /bin/echo " ntcoin [ --def | -d ]: to print only the #define preprocessor directives without creating any directories" /bin/echo " ntcoin [ --help | -h ] : to print this help" elif [ "$3" = "--def" ] || [ "$3" = "-d" ] then /bin/echo "Printing tcoin.cpp (and pcoin.cpp) preprocessor directives." /bin/echo 'Paste the following in '`/usr/bin/realpath -s $2`'/tcoin/bin/tcoin_defs.cpp (and '`/usr/bin/realpath -s $1`'/tcoin/bin/pcoin_defs.cpp): ' /bin/echo '#define TCOIN_PATH "'`/usr/bin/realpath -s $1`'/tcoin" #define TCOIN_MSG_PATH "'`/usr/bin/realpath -s $1`'/tcoin/messages/" #define TCOIN_SALT_PATH "'`/usr/bin/realpath -s $1`'/tcoin/salts/" #define TCOIN_PASS_PATH "'`/usr/bin/realpath -s $1`'/tcoin/passwords/" #define TCOIN_PROG_ACT_PATH "'`/usr/bin/realpath -s $1`'/tcoin/program_accounting/" #define PROG_ACT_W_SLASH "program_accounting/" #define PCOIN_KEY_PATH "'`/usr/bin/realpath -s $1`'/tcoin/secrets/pcoin_keys" #define TCOIN_CODEZ_PATH "'`/usr/bin/realpath -s $1`'/tcoin/secrets/tcoin_codez" #define TCOIN_BIN_PATH_W_SPACE "'`/usr/bin/realpath -s $2`'/tcoin " #define TCOIN_PATH_W_SLASH "'`/usr/bin/realpath -s $1`'/tcoin/" #define TCOIN_SCRYPT_PATH "'`/usr/bin/realpath -s $1`'/tcoin/bin/scrypt" #define PCOIN_BIN_PATH "'`/usr/bin/realpath -s $2`'/pcoin" #define PCOIN_BIN_PATH_W_SPACE "'`/usr/bin/realpath -s $2`'/pcoin " #define KROWBAR_OFF #define DA_OFF #define MINERCOIN_OFF' else #see https://stackoverflow.com/a/3951175 case $3 in ''|*[!0-9]*) /bin/echo "Sorry, the number of basecoins should be a positive integer."; exit 1 ;; *) ;; esac if [ -d "`/usr/bin/realpath -s $1`/tcoin" ] then /bin/echo "Sorry, '`/usr/bin/realpath -s $1`/tcoin' already exists." exit 1 else /bin/mkdir "`/usr/bin/realpath -s $1`/tcoin" /bin/chmod 700 "`/usr/bin/realpath -s $1`/tcoin" /bin/chmod u+s "`/usr/bin/realpath -s $1`/tcoin" fi if [ -d "`/usr/bin/realpath -s $1`/tcoin/salts" ] then /bin/echo "Sorry, '`/usr/bin/realpath -s $1`/tcoin/salts' already exists." exit 1 else /bin/mkdir "`/usr/bin/realpath -s $1`/tcoin/salts" /bin/chmod 700 "`/usr/bin/realpath -s $1`/tcoin/salts" /bin/chmod u+s "`/usr/bin/realpath -s $1`/tcoin/salts" fi if [ -d "`/usr/bin/realpath -s $1`/tcoin/passwords" ] then /bin/echo "Sorry, '`/usr/bin/realpath -s $1`/tcoin/passwords' already exists." exit 1 else /bin/mkdir "`/usr/bin/realpath -s $1`/tcoin/passwords" /bin/chmod 700 "`/usr/bin/realpath -s $1`/tcoin/passwords" /bin/chmod u+s "`/usr/bin/realpath -s $1`/tcoin/passwords" fi if [ -d "`/usr/bin/realpath -s $1`/tcoin/program_accounting" ] then /bin/echo "Sorry, '`/usr/bin/realpath -s $1`/tcoin/program_accounting' already exists." exit 1 else /bin/mkdir "`/usr/bin/realpath -s $1`/tcoin/program_accounting" /bin/chmod 700 "`/usr/bin/realpath -s $1`/tcoin/program_accounting" /bin/chmod u+s "`/usr/bin/realpath -s $1`/tcoin/program_accounting" fi if [ -d "`/usr/bin/realpath -s $1`/tcoin/messages" ] then /bin/echo "Sorry, '`/usr/bin/realpath -s $1`/tcoin/messages' already exists." exit 1 else /bin/mkdir "`/usr/bin/realpath -s $1`/tcoin/messages" /bin/chmod 700 "`/usr/bin/realpath -s $1`/tcoin/messages" /bin/chmod u+s "`/usr/bin/realpath -s $1`/tcoin/messages" fi if [ -d "`/usr/bin/realpath -s $1`/tcoin/base" ] then /bin/echo "Sorry, '`/usr/bin/realpath -s $1`/tcoin/base' already exists." exit 1 else /bin/mkdir "`/usr/bin/realpath -s $1`/tcoin/base" /bin/chmod 700 "`/usr/bin/realpath -s $1`/tcoin/base" /bin/chmod u+s "`/usr/bin/realpath -s $1`/tcoin/base" if [ -e "`/usr/bin/realpath -s $1`/tcoin/base/base.txt" ] then /bin/echo "Sorry, '`/usr/bin/realpath -s $1`/tcoin/base/base.txt' already exists." exit 1 else
import os, time
class Dirsize():
	def a(path):
		return len(os.listdir(path))

	def b(path):
		for _, dirs, files in os.walk(path):
			return len(files) + len(dirs)

	def c(path):
		first = next(os.walk(path