<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jan Chęć on Medium]]></title>
        <description><![CDATA[Stories by Jan Chęć on Medium]]></description>
        <link>https://medium.com/@zwinny?source=rss-5ff65d2a2be1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Oym4eUlnN7d_KRoonkwqZg.jpeg</url>
            <title>Stories by Jan Chęć on Medium</title>
            <link>https://medium.com/@zwinny?source=rss-5ff65d2a2be1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 22:09:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@zwinny/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Writing “shell scripts” in Python with a funny lib Plumbum]]></title>
            <link>https://medium.com/@zwinny/writing-shell-scripts-in-python-with-a-funny-lib-plumbum-777dddc82bfa?source=rss-5ff65d2a2be1------2</link>
            <guid isPermaLink="false">https://medium.com/p/777dddc82bfa</guid>
            <category><![CDATA[shell-script]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[bash]]></category>
            <dc:creator><![CDATA[Jan Chęć]]></dc:creator>
            <pubDate>Mon, 30 Jul 2018 15:05:08 GMT</pubDate>
            <atom:updated>2018-07-30T15:07:40.019Z</atom:updated>
            <content:encoded><![CDATA[<p>Take a look at this:</p><pre><strong>In [1]:</strong> from plumbum.cmd import echo, grep, cat</pre><pre><strong>In [2]:</strong> echo[&#39;lol\nwat&#39;]()                                 <br><strong>Out[2]:</strong> &#39;lol\nwat\n&#39;</pre><pre><strong>In [3]:</strong> print(echo[&#39;lol\nwat&#39;]())                          <br>lol                                                        <br>wat</pre><pre><strong>In [4]:</strong> echo[&#39;lol\nwat&#39;] | grep[&#39;-o&#39;, &#39;wat&#39;]               <br><strong>Out[4]:</strong> Pipeline(BoundCommand(LocalCommand(/bin/echo), [&#39;lol\nwat&#39;]), BoundCommand(LocalCommand(/bin/grep), [&#39;-o&#39;, &#39;wat&#39;]))</pre><pre><strong>In [5]:</strong> _()                                                <br><strong>Out[5]:</strong> &#39;wat\n&#39;</pre><pre><strong>In [6]:</strong> (echo[&#39;lol\nwat&#39;] &gt; &#39;crap.txt&#39;)()                  <br><strong>Out[6]:</strong> &#39;&#39;</pre><pre><strong>In [7]:</strong> cat[&#39;crap.txt&#39;]()                                  <br><strong>Out[7]:</strong> &#39;lol\nwat\n&#39;</pre><pre><strong>In [8]:</strong> print(cat[&#39;crap.txt&#39;]())                           <br>lol                                                        <br>wat</pre><pre><strong>In [9]:</strong> from plumbum import local</pre><pre><strong>In [10]:</strong> notify_send = local[&#39;notify-send&#39;]</pre><pre><strong>In [11]:</strong> notify_send[&#39;notification!&#39;]()<br><strong>Out[11]:</strong> &#39;&#39;</pre><p>Plumbum: <a href="https://plumbum.readthedocs.io/en/latest/">https://plumbum.readthedocs.io/en/latest/</a></p><p>The ease of writing text to a file or reading a file charmed me. Just (echo[some_string] &gt; filename)() and it’s written. Similarly reading a file: contents = cat[filename]() and that’s it. Piping is quite nice too and allows you to dissect it into parts without much change.</p><p>While I wouldn’t recommend using the above for regular file writing or reading (going through invocations of another programs), this syntax enables you to transform a Bash script to Python script in a way that the result is very similar to the original.</p><p>An icing on the cake is the touch of magic that resides in plumbum.cmd. You can import anything from it:</p><pre>from plumbum.cmd import xvnc4viewer</pre><p>It is equivalent to:</p><pre>from plumbum import local</pre><pre>xvnc4viewer = local[&#39;xvnc4viewer&#39;]</pre><p>Even when a command has a dash - in it, you can just import the name with underscores in dashes’ places:</p><pre><strong>In [1]:</strong> from plumbum.cmd import notify_send</pre><pre><strong>In [2]:</strong> notify_send<br><strong>Out[2]:</strong> LocalCommand(/usr/bin/notify-send)</pre><h4>Why even bother writing shell scripts in Python?</h4><p>Bash is concise, but if your script grows too big or has more advanced logic, it becomes a hardly testable abomination that strikes fear into the hearts of fellow programmers. When a Bash script grows too big for it’s own good, the solution is to use a high level language like Python that has capability to execute shell commands. The code becomes clean and testable (just mock the shell commands).</p><p>There are multiple ways to do it in Python. The most basic and quite compact is by using subprocess , like:</p><pre><strong>In [6]:</strong> subprocess.check_output([&#39;which&#39;, &#39;bash&#39;])<br><strong>Out[6]:</strong> b&#39;/bin/bash\n&#39;</pre><pre><strong>In [7]:</strong> subprocess.check_output(&#39;which bash&#39;, shell=True)  <br><strong>Out[7]:</strong> b&#39;/bin/bash\n&#39;</pre><p>But then, as you can see, those are bytes. So:</p><pre><strong>In [11]:</strong> subprocess.check_output([&#39;which&#39;, &#39;bash&#39;], universal_newlines=True)                                           <br><strong>Out[11]:</strong> &#39;/bin/bash\n&#39;</pre><p>Fixed. It also has pipes etc., you can see examples here: <a href="https://docs.python.org/3/library/subprocess.html#replacing-older-functions-with-the-subprocess-module">https://docs.python.org/3/library/subprocess.html#replacing-older-functions-with-the-subprocess-module</a></p><p>The problem that I have with this module is that it’s just way uglier than it could be. It’s like os+sys vs pathlib. Ugh.</p><h4>Fabric?</h4><p>If you already use Fabric for deployments, why not use api.local() then? Seems compact too:</p><pre><strong>In [7]:</strong> api.local(&#39;which bash&#39;, capture=True)<br>[localhost] local: which bash<br><strong>Out[7]:</strong> &#39;/bin/bash&#39;</pre><p>It prints to stderr what command was used ( [localhost] local: which bash). You can disable this:</p><pre><strong>In [8]:</strong> with api.hide(&#39;running&#39;):<br><strong>   ...:</strong>     output = api.local(&#39;which bash&#39;, capture=True)<br><strong>   ...:</strong></pre><pre><strong>In [9]:</strong> output<br><strong>Out[9]:</strong> &#39;/bin/bash&#39;</pre><p>Then again, it doesn’t add newline at the end of commands (convenient at times, but detrimental at another — for example: read then write a file, seemingly without a change), so you have to add it yourself:</p><pre><strong>In [12]:</strong> with api.hide(&#39;running&#39;):<br><strong>    ...:</strong>     output = api.local(&#39;which bash&#39;, capture=True)<br><strong>    ...:</strong>     if output and output[-1] != &#39;\n&#39;:<br><strong>    ...:</strong>         output += &#39;\n&#39;<strong><br>    ...:</strong></pre><pre><strong>In [13]:</strong> output<br><strong>Out[13]:</strong> &#39;/bin/bash\n&#39;</pre><p>Err…</p><pre><strong>In [14]:</strong> subprocess.check_output(&#39;which bash&#39;, shell=True, universal_newlines=True)<br><strong>Out[14]:</strong> &#39;/bin/bash\n&#39;</pre><p>I see no reason to use Fabric in local scripts. Better to write a wrapper over subprocess.check_output with the defaults you want.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=777dddc82bfa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker — using webcam]]></title>
            <link>https://medium.com/@zwinny/docker-using-webcam-9fafb26cf1e6?source=rss-5ff65d2a2be1------2</link>
            <guid isPermaLink="false">https://medium.com/p/9fafb26cf1e6</guid>
            <category><![CDATA[webcam]]></category>
            <category><![CDATA[usb]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[docker-compose]]></category>
            <category><![CDATA[devices]]></category>
            <dc:creator><![CDATA[Jan Chęć]]></dc:creator>
            <pubDate>Wed, 18 Apr 2018 17:13:48 GMT</pubDate>
            <atom:updated>2018-04-18T17:13:48.245Z</atom:updated>
            <content:encoded><![CDATA[<p>Add to docker-compose:</p><pre><strong>devices:<br>  </strong>- /dev/video0:/dev/video0</pre><p>Or append to your docker run command: --device=/dev/video0:/dev/video0 .</p><p>If you’re using a non-root user in Docker, they won’t have a permission to use /dev/video0. But this device-file will be available only after starting a container, so you can’t chmod it in the Dockerfile. But you can add the user to video group which does the trick:</p><pre><strong>RUN </strong>sudo usermod <strong>-</strong>a <strong>-</strong>G video developer</pre><p>Voila!</p><p>The similar scenario should be used in many (all?) of the device cases: add a path to it in docker-compose or docker run command. Then check what group does the device have and add the user to it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9fafb26cf1e6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Filling PDF Forms In Python — The Right Way]]></title>
            <link>https://medium.com/@zwinny/filling-pdf-forms-in-python-the-right-way-eb9592e03dba?source=rss-5ff65d2a2be1------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb9592e03dba</guid>
            <category><![CDATA[forms]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[svg]]></category>
            <category><![CDATA[pdf]]></category>
            <dc:creator><![CDATA[Jan Chęć]]></dc:creator>
            <pubDate>Wed, 05 Apr 2017 08:21:57 GMT</pubDate>
            <atom:updated>2018-04-13T12:16:08.949Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently at Sigmoidal we had a curious case of filling PDF forms for our users. They can print them out pre-filled by us and use. We had plenty of those forms to set up, so an efficient way of doing it was required.</p><h3>Solution 0 — Putting Texts In Python</h3><p>The simplest solution goes like this:</p><ol><li>take an unfilled PDF form</li><li>create an empty canvas in Python</li><li>add texts to the canvas</li><li>merge</li></ol><p>This can be done using <em>pdfrw</em> and <em>reportlab</em> libs. Quick example filling “John” and “Willis”:</p><pre><strong>import </strong>io<br><br><strong>import </strong>pdfrw<br><strong>from </strong>reportlab.pdfgen <strong>import </strong>canvas<br><br><br><strong>def run</strong>():<br>    canvas_data = get_overlay_canvas()<br>    form = merge(canvas_data, template_path=&#39;./template.pdf&#39;)<br>    save(form, filename=&#39;merged.pdf&#39;)<br><br><br><strong>def </strong>get_overlay_canvas() -&gt; io.BytesIO:<br>    data = io.BytesIO()<br>    pdf = canvas.Canvas(data)<br>    pdf.drawString(x=33, y=550, text=&#39;Willis&#39;)<br>    pdf.drawString(x=148, y=550, text=&#39;John&#39;)<br>    pdf.save()<br>    data.seek(0)<br>    <strong>return </strong>data<br><br><br><strong>def merge</strong>(overlay_canvas: io.BytesIO, template_path: str) -&gt; io.BytesIO:<br>    template_pdf = pdfrw.PdfReader(template_path)<br>    overlay_pdf = pdfrw.PdfReader(overlay_canvas)<br>    <strong>for </strong>page, data <strong>in </strong>zip(template_pdf.pages, overlay_pdf.pages):<br>        overlay = pdfrw.PageMerge().add(data)[0]<br>        pdfrw.PageMerge(page).add(overlay).render()<br>    form = io.BytesIO()<br>    pdfrw.PdfWriter().write(form, template_pdf)<br>    form.seek(0)<br>    <strong>return </strong>form<br><br><br><strong>def save</strong>(form: io.BytesIO, filename: str):<br>    <strong>with </strong>open(filename, &#39;wb&#39;) <strong>as </strong>f:<br>        f.write(form.read())<br><br><strong>if </strong>__name__ == &#39;__main__&#39;:<br>    run()</pre><h4>Pros:</h4><ul><li>it works :D</li></ul><h4>Cons:</h4><ul><li>We have a presentation layer in our code.</li><li>Positioning texts is cumbersome (file watchers, that refresh your preview after every change, are a great help, but it still is a lot of manual labor).</li><li>We have no information about width or height of our fields — long texts would need manual splitting in lines, changing font etc. We display texts from users, so we need automation here.</li></ul><p>With this solution our programmers started avoiding this code as long as they could. I didn’t like that and I had some ideas how to improve it.</p><h3>Solution 1 — Save Fields Locations as a Vector Graphic</h3><p>I’d prefer to visually position some rectangles as text fields on our document. My first idea was to use a vector graphics file:</p><ol><li>save the PDF as an image</li><li>open it in vector graphics editor</li><li>add rectangles labeled with dictionary keys</li><li>save as a vector graphic</li><li>read the vector graphic in Python as a configuration for filling the PDF</li></ol><p>I haven’t implemented this because I had a better idea (below), but I’d use SVG and some of many SVG libraries for Python. This format can have labeled shapes and we can read those and their locations in backend.</p><h4>Pros:</h4><ul><li>separation of presentation and logic layers</li><li>we have width and height of fields, we can compute how to position texts and what font size to pick</li></ul><h4>Cons:</h4><ul><li>we have at least two files for a PDF (the PDF and one CSV per PDF’s page)</li><li>…which also makes it awkward to use in code</li><li>still we have a bit of presentation logic in our backend (picking font size and positioning)</li></ul><p>So here we go to the better solution:</p><h3>Solution 2 — Use Fields From PDF</h3><p>Nowadays PDFs can have fillable fields. User can fill them and print the doc. This seems fantastic because we could just fill them and even give our end user an ability to change them. All we need in our backend is to set default fields values to real user data and save.</p><p>Seems great, but I tested several open source libraries and they either can’t change those or can change fields’ attributes, but they don’t rerender them. So in the latter case we are left with a file that has all the fields set, but they won’t display until a user clicks on a field and then defocuses. <a href="https://github.com/pmaupin/pdfrw/issues/84">I’ve opened a ticket on pdfrw’s GitHub with this issue</a>, hope it will be fixed or it’s already working but I don’t know about something yet.</p><p>So how do we solve it now? <strong>Just use those fields in the same manner as CSV rectangles proposed in Solution 1</strong> — make them invisible and use them as anchors for our additional texts:</p><ol><li>open the PDF in a PDF editor (Master PDF Editor seems nice and in its free Linux version it doesn’t add any watermark… yet)</li><li>add invisible, read only fields when your texts should be, make them as big as possible and sensible</li><li>label them with keys of your data dictionary on backend (be careful to make them unique — I use a suffix after dot and split labels by dots)</li><li>save the PDF</li><li>in backend use metadata from the PDF to position texts</li></ol><p>We can get fields’ metadata like so:</p><pre>for page in template.Root.Pages.Kids:<br>    for field in page.Annots:<br>        label = field.T<br>        sides_positions = field.Rect</pre><p>Then use those to add fields from our data dict. Quick &amp; dirty example:</p><pre>data = io.BytesIO()<br>pdf = canvas.Canvas(data)<br>for page in template.Root.Pages.Kids:<br>    for field in page.Annots:<br>        label = field.T<br>        sides_positions = field.Rect<br>        left = min(sides_positions[0], sides_positions[2])<br>        bottom = min(sides_positions[1], sides_positions[3])<br>        user_data = {<br>            &#39;last_name&#39;: &#39;Willis&#39;,<br>            &#39;first_name&#39;: &#39;John&#39;,<br>        }<br>        value = user_data.get(label, &#39;&#39;)<br>        padding = 10<br>        line_height = 15<br>        pdf.drawString(x=left + padding, y=bottom + padding + line_height, text=value)<br>    pdf.showPage()<br>pdf.save()<br>data.seek(0)<br>return data</pre><p>(Please use some classes for representing fields metadata in your code.)</p><h4>Pros:</h4><ul><li>holding presentation layer in the PDF</li><li>neat, clean &amp; tidy</li><li>we can compute best way to display long values because we have positions, widths and heights of every field</li><li>we can add new forms without changing a line of code (we have a pattern for naming)</li></ul><h4>Cons:</h4><ul><li>still we have a little bit of presentation logic on backend side (splitting lines, picking fonts, etc.)</li><li>labels have to be unique (some random suffix possibly)</li><li>changing of backend labels will require iterating over all files (the same problem like changing a source string in translations)</li></ul><h3>Solution 3 — Use PDF Form’s Default Value</h3><p>Like said in Solution 2, it can’t be done with tools I know. We can update it like so:</p><pre>template = pdfrw.PdfReader(&#39;template.pdf&#39;)<br>template.Root.Pages.Kids[0].Annots[3].update(pdfrw.PdfDict(V=&#39;(test)&#39;))<br>pdfrw.PdfWriter().write(&#39;test.pdf&#39;, template)</pre><p>But it doesn’t rerender the fields so they are blank until focused and then defocused. It would be great if it worked.</p><h4>Additional pros:</h4><ul><li>handling font picking and too long lines on the presentation side</li><li>user can change values before printing</li><li>less code (less mess = god bless)</li></ul><h3>Summary</h3><p>While the best solution is not reachable yet, the change gave us a great speedup. Now adding a new form is a breeze, especially because we can copy fields between PDFs in editor. Hope to see rerendering of changed default values soon!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb9592e03dba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Inconsistent isort results from the same version]]></title>
            <link>https://medium.com/@zwinny/different-isort-results-from-the-same-version-15c277600957?source=rss-5ff65d2a2be1------2</link>
            <guid isPermaLink="false">https://medium.com/p/15c277600957</guid>
            <category><![CDATA[flake8]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[isort]]></category>
            <dc:creator><![CDATA[Jan Chęć]]></dc:creator>
            <pubDate>Thu, 16 Feb 2017 17:20:16 GMT</pubDate>
            <atom:updated>2017-02-16T17:21:34.155Z</atom:updated>
            <content:encoded><![CDATA[<p>The same version of all packages on two machines. The difference — one has them on virtualenv, the other globally.</p><h3><strong>The problem</strong></h3><p><em>isort</em> can’t correctly determine which imports are from third party and first party when it’s installed globally.</p><h3><strong>Fixes</strong></h3><h4>With conversion to virtualenv</h4><p>Just install it in virtualenv. It may not be optimal when you’re using virtualization already.</p><h4>Without</h4><p>In <em>isort</em> settings file set:</p><pre>default_section=THIRDPARTY</pre><p>Also list all your local packages in the following option:</p><pre>known_first_party=</pre><p>For example:</p><pre>known_first_party=my_awesome_package,tests,utils,more_utils,everything_is_an_util</pre><p>Cumbersome, but that’s the workaround. Hopefully it will be fixed.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15c277600957" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cassandra with Docker]]></title>
            <link>https://medium.com/@zwinny/cassandra-with-docker-915153e0592c?source=rss-5ff65d2a2be1------2</link>
            <guid isPermaLink="false">https://medium.com/p/915153e0592c</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[cassandra]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[nosql]]></category>
            <dc:creator><![CDATA[Jan Chęć]]></dc:creator>
            <pubDate>Thu, 26 Jan 2017 10:35:31 GMT</pubDate>
            <atom:updated>2017-01-26T10:37:22.925Z</atom:updated>
            <content:encoded><![CDATA[<p>Cassandra is a NoSQL database that can handle huge volume of reads and writes with multiple nodes that synchronize P2P style. By my research it’s the best database to store great amount of raw data.</p><p>This is a compressed guide how to setup Cassandra to work with Docker.</p><h3>Running</h3><p>Running new is simple:</p><pre>docker run --name some-container-name -d cassandra:2.2.8</pre><p>This is for version 2.2.6, which seems currently best for robustness and features as well.</p><h3>Clusters</h3><h4>On the Same Machine</h4><p>Just link new instance to the previous one, naming it “<em>cassandra</em>”:</p><pre>docker run --name some-container-name-again -d<strong> --link some-container-name:cassandra</strong> cassandra:2.2.8</pre><p>Other option is passing an env variable CASSANDRA_SEEDS with IP address of currently existing Cassandra instance:</p><pre>docker run --name some-container-name-again -d <strong>-e CASSANDRA_SEEDS=”172.21.2.55&quot;</strong> cassandra:2.2.8</pre><p>Or you can use docker inspect to get IP of the first Cassandra:</p><pre>docker run --name some-container-name-again -d <strong>-e CASSANDRA_SEEDS=”$(docker inspect --format=&#39;{{ .NetworkSettings.IPAddress }}&#39; some-container-name)&quot;</strong> cassandra:2.2.8</pre><h4>On Different Machines</h4><p>Additionally to passing env variable CASSANDRA_SEEDS like above, you need to do on every instance:</p><ul><li>open Cassandra’s gossip port <strong>7000</strong> (for example: -p 7000:7000)</li><li>pass env variable <strong>CASSANDRA_BROADCAST_ADDRESS</strong> with it’s machine’s IP (for example: -e CASSANDRA_BROADCAST_ADDRESS=10.5.2.1)</li></ul><p>For example:</p><pre>docker run --name some-container-name -d -e <strong>CASSANDRA_BROADCAST_ADDRESS=10.1.1.1 -p 7000:7000</strong> cassandra:2.2.8</pre><pre>docker run --name some-container-name-again -d -e <strong>CASSANDRA_BROADCAST_ADDRESS=10.2.2.2</strong> CASSANDRA_SEEDS=10.1.1.1<strong> -p 7000:7000</strong> cassandra:2.2.8</pre><h3>Running Queries</h3><p>Execute <em>cqlsh</em> (Cassandra Query Language Shell):</p><pre>docker <strong>exec -it </strong>some-container-name <strong>cqlsh</strong></pre><p>Type HELP :&gt;</p><h3>Logs</h3><pre>docker <strong>logs</strong> some-container-name</pre><h3>Data Location</h3><h4>By Default</h4><p>Internally it is stored in /var/lib/cassandra, which is by default a volume. You can locate it by:</p><pre>docker <strong>inspect --format “{{range .Mounts }}{{ .Source }}{{ end }}”</strong> some-container-name</pre><p>Example output:</p><pre>/var/lib/docker/volumes/39184c4df2ebae178d02855ac7ec210cb2b5c7db089222592ac1c547f065d35a/_data</pre><p>So the data should persist through container’s restarts.</p><h4>Custom Location</h4><p>You can change the data storage location by defining a custom volume destination when running:</p><pre>docker run --name some-container-name <strong>-v /srv/some_cassandra:/var/lib/cassandra</strong> -d cassandra:2.2.8</pre><h3>Limiting RAM usage</h3><p>On default Cassandra with empty database takes about 600MB of RAM. You can manipulate initial RAM by passing 2 additional options:</p><ul><li>for <strong>initial</strong> heap size: HEAP_NEWSIZE</li><li>for <strong>maximum</strong> heap size: MAX_HEAP_SIZE</li></ul><p><strong>They have to be used together</strong> if used at all.</p><p>Example setup for minimal RAM usage (for development):</p><pre>docker run --name some-container-name <strong>-e HEAP_NEWSIZE=1M -e MAX_HEAP_SIZE=1024M</strong> -d cassandra:2.2.8</pre><p>Increasing MAX_HEAP_SIZE above 1024MB will increase initial RAM usage as well.</p><h3>Further Reading</h3><ul><li>More in depth reference (source of the article) with a list of possible <strong>environment variables</strong> (skip deprecated Thrift RPC): <br><a href="https://hub.docker.com/_/cassandra/">https://hub.docker.com/_/cassandra/</a></li><li>Cassandra 2.2 features: <br><a href="http://docs.datastax.com/en/archived/cassandra/2.2/cassandra/features.html">http://docs.datastax.com/en/archived/cassandra/2.2/cassandra/features.html</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=915153e0592c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>