A simple client for posting text to your 750words.com account. Can also be used to query your current word count or the current text. Emacs integration is also available.
You can see its full annotated source code in the 750words-client.org file.
[750words-client on Docker Hub][Dockerfile]
You can use 750words-client.py
from its Docker image as follows (the image will be downloaded from Docker Hub the first time you use it):
docker run zzamboni/750words-client --help
Note that you have to define the USER_750WORDS
and PASS_750WORDS
environment variables in your environment, and pass them to the container. You also need to pass the -i
option to docker run
if you want to read the input from standard input, e.
cat file.txt | docker run -i -e USER_750WORDS -e PASS_750WORDS zzamboni/750words-client
If you want to build the image yourself, you can do it as follows from a checkout of its git repository:
docker build --tag 750words-client .
Clone the git repository:
git clone https://github.com/zzamboni/750words.git
You need the following libraries and components installed:
- Selenium Python bindings (run
pip install -r requirements.txt
) - Google Chrome is used to automate the connections.
- ChromeDriver so that Selenium can connect to Chrome - make sure you install the version that corresponds to the Chrome version you have installed.
You can then copy 750words-client.py
to somewhere in your $PATH
to use it.
750words-client.py --help
usage: 750words-client.py [-h] [--min MIN] [--max MAX] [--only-if-needed]
[--replace] [--count] [--text] [--quiet]
[--no-headless] [--no-quit]
[FILE ...]
Interact with 750words.com from the command line.
positional arguments:
FILE Input files for text to add. Default is to read from
standard input.
optional arguments:
-h, --help show this help message and exit
--min MIN Minimum number of words needed. Default: 750.
--max MAX Maximum total number of words allowed. Default: 5000.
--only-if-needed Only add text if current word count is below MIN.
--replace Replace any current text with the new one, default is to
add at the end.
--count Don't upload text, only print the current word count.
--text Don't upload text, only print the current text.
--quiet Don't print progress messages.
debugging options:
--no-headless Disable headless mode (opens the Chrome app window).
--no-quit Don't quit the browser at the end.
Your 750words.com credentials must be stored in the USER_750WORDS and
PASS_750WORDS environment variables.
For example (in this case there were already some words entered previously in the day):
> echo "This is some text to enter" | 750words-client.py
Got text: This is some text to enter
(6 words)
Connecting to 750words.com...
Authenticating...
Finding current text entry...
Current word count: 1324
Entering new text...
Saving...
New word count: 1330
You completed your 750 words for today!
Done!
The 750words
Emacs library allows using the 750words-client
command line program to post text from within Emacs. With it, you can post an entire buffer, or a selected region. Support for auth-sources
is provided so you don’t have to store your credentials in your Emacs config. Additionally, the ox-750words
library enables an Org exporter which posts the contents of your Org buffer, region or subtree to 750words.com, converting it first to Markdown, which is understood by 750words.com.
First, you need to have the 750words-client.py
command line installed, or its Docker image.
For now the library is not yet in MELPA, so you need to install it from this repository. If you use Doom Emacs, you can add the following line to your package.el
file:
(package! 750words
:recipe (:host github
:repo "zzamboni/750words-client"
:files ("*.el")))
And then load it from your config.el
as follows. You only need to load ox-750words
if you want to use the exporter from within Org mode.
(use-package! 750words)
(use-package! ox-750words)
If you prefer to install by hand, you can clone this repository, store the 750words.el
and ox-750words.el
files somewhere in your load-path
, and load them as follows:
(require '750words)
(require 'ox-750words)
If you use auth-sources
, you can store your 750words.com credentials by storing them in the appropriate store associated with the host “750words.com”. For example, if variable auth-sources
contains ~/.authinfo.gpg
, you can add a line in the following format:
machine 750words.com login <email address> password <password>
You can then run 750words-credentials-setenv
to read the credentials and store them in the correct environment variables.
Note: If the auth-source you use supports entry creation (for example, ~/.authinfo.gpg
does) you can run C-u M-x 750words-credentials-setenv
- you will be prompted for your credentials and they will be automatically stored.
After you have loaded your credentials, you can use the following commands to post text:
M-x 750words-region-or-buffer
: if you have a region selected, it will be posted. Otherwise, the whole buffer will be posted.M-x 750words-region
: post the currently selected region (issues an error if no region is selected).M-x 750words-buffer
: post the entire current buffer.- If you are in an Org buffer and loaded
ox-750words
, you can open the export screen (C-c C-e
) and find the item[7] Post to 750words.com
inside the[m] Export to Markdown
section to post your current Org file in Markdown format.
By default, the 750words-client.py
is executed, assuming you have it installed. If you want to use its Docker image, you can configure it as follows:
(setq 750words-client-command "cat %s | docker run -i -e USER_750WORDS -e PASS_750WORDS zzamboni/750words-client")