git rm --cached '\*\*.swp'
+ git rm --cached '\*\*.swp'
diff --git a/authors.html b/authors.html
index f3d9633..42a7483 100644
--- a/authors.html
+++ b/authors.html
@@ -89,6 +89,8 @@
@@ -121,7 +117,7 @@
Authors on balkian.com
- J. Fernando Sánchez (9)
+
diff --git a/categories.html b/categories.html
index 85eec63..d5dcbc5 100644
--- a/categories.html
+++ b/categories.html
@@ -89,6 +89,8 @@
diff --git a/category/cheats.html b/category/cheats.html
index efbf181..4f7bcd1 100644
--- a/category/cheats.html
+++ b/category/cheats.html
@@ -123,7 +123,7 @@
Black screen and LightDM doesn't unlock
Add this to your /etc/lightdm/lightdm.conf file:
[LightDM]
logind-check-graphical = true
@@ -141,7 +141,7 @@
Show plain text version
-
diff --git a/category/misc.html b/category/misc.html
index 0b8fdfc..21011a8 100644
--- a/category/misc.html
+++ b/category/misc.html
@@ -90,6 +90,8 @@
@@ -127,6 +125,27 @@
+
+
+
2016-09-28
+
python
+
+
+
tqdm is a nice way to add progress bars in the command line or in a jupyter notebook.
+
+
from tqdm import tqdm
+import time
+
+for i in tqdm ( range ( 100 )):
+ time . sleep ( 1 )
+
+
+
+
2015-04-10
@@ -175,7 +194,7 @@ a WSGI application with the name
application . Hence, wsgi:application.<
2
3
4
-5
<Location /myapp/ >
ProxyPass http://127.0.0 ...
@@ -217,7 +236,7 @@ gathered from media in several languages. Then we aggregated ...
A simple trick. If you want to remove all the '.swp' files from a git
repository, just use:
-
git rm --cached '\*\*.swp'
+ git rm --cached '\*\*.swp'
diff --git a/creating-my-web.html b/creating-my-web.html
index c5c831d..4ff8a93 100644
--- a/creating-my-web.html
+++ b/creating-my-web.html
@@ -91,6 +91,8 @@
@@ -163,7 +159,7 @@ on Github. You can
clone and deploy it easily like this:
git clone
https://github.com/balkian/balkian.github.com cd balkian.github.com
jekyll serve -w
diff --git a/feeds/all.atom.xml b/feeds/all.atom.xml
index 60a47d9..04ffce7 100644
--- a/feeds/all.atom.xml
+++ b/feeds/all.atom.xml
@@ -1,15 +1,27 @@
-balkian.com http://balkian.com/ 2016-02-03T20:00:00+01:00 Arch Linux Fixes 2016-02-03T20:00:00+01:00 J. Fernando Sánchez tag:balkian.com,2016-02-03:arch-linux-fixes.html <div class="section" id="black-screen-and-lightdm-doesn-t-unlock">
+balkian.com http://balkian.com/ 2016-09-28T18:47:00+02:00 Progress bars in python 2016-09-28T18:47:00+02:00 J. Fernando Sánchez tag:balkian.com,2016-09-28:progress-bars-in-python.html <p><a class="reference external" href="https://github.com/noamraph/tqdm">tqdm</a> is a nice way to add progress bars in the command line or in a jupyter notebook.</p>
+<img alt="" src="https://camo.githubusercontent.com/48838faaa8d00ea297f18e5bf55d3c6bb4e0ba6b/68747470733a2f2f692e696d6775722e636f6d2f686539417735432e676966" />
+<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
+2
+3
+4
+5</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">tqdm</span> <span class="kn">import</span> <span class="n">tqdm</span>
+<span class="kn">import</span> <span class="nn">time</span>
+
+<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">tqdm</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="mi">100</span><span class="p">)):</span>
+ <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
+</pre></div>
+</td></tr></table> Arch Linux Fixes 2016-02-03T20:00:00+01:00 J. Fernando Sánchez tag:balkian.com,2016-02-03:arch-linux-fixes.html <div class="section" id="black-screen-and-lightdm-doesn-t-unlock">
<h2>Black screen and LightDM doesn't unlock</h2>
<p>Add this to your <cite>/etc/lightdm/lightdm.conf</cite> file:</p>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
-2</pre></div></td><td class="code"><div class="highlight"><pre><span class="k">[LightDM]</span>
+2</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="k">[LightDM]</span>
<span class="na">logind-check-graphical</span><span class="o">=</span><span class="s">true</span>
</pre></div>
</td></tr></table></div>
Org-mode tricks 2015-12-10T11:34:00+01:00 J. Fernando Sánchez tag:balkian.com,2015-12-10:org-mode-tricks.html <div class="section" id="show-plain-text-version">
<h2>Show plain text version</h2>
-<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span class="p">(</span><span class="nv">font-lock-mode</span><span class="p">)</span>
+<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="p">(</span><span class="nv">font-lock-mode</span><span class="p">)</span>
</pre></div>
</td></tr></table></div>
Sharing dotfiles 2015-04-10T17:47:00+02:00 J. Fernando Sánchez tag:balkian.com,2015-04-10:sharing-dotfiles.html <p>Today's post is half a quick note, half public shaming. In other words, it is a reminder to be very careful with OAuth tokens and passwords.</p>
@@ -19,13 +31,13 @@ This is cool and convenient, unless you <a class="reference external" href="h
<p>So, how can you still share your gitconfig without sharing your password/token with the rest of the world?
Since Git 1.7.0, you can <a class="reference external" href="http://stackoverflow.com/questions/1557183/is-it-possible-to-include-a-file-in-your-gitconfig">include other files in your gitconfig</a>.</p>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
-2</pre></div></td><td class="code"><div class="highlight"><pre>[include]
+2</pre></div></td><td class="code"><div class="highlight"><pre><span></span>[include]
path = ~/.gitconfig_secret
</pre></div>
</td></tr></table><p>And now, in your .gitconfig_secret file, you just have to add this:</p>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
2
-3</pre></div></td><td class="code"><div class="highlight"><pre>[github]
+3</pre></div></td><td class="code"><div class="highlight"><pre><span></span>[github]
user = balkian
token = "< Your secret token >"
</pre></div>
@@ -41,10 +53,10 @@ Debian/Ubuntu.</p>
<div class="section" id="setting-up-apache">
<h2>Setting up Apache</h2>
<p>First we need to install Apache:</p>
-<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre>sudo apt-get install apache2
+<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span></span>sudo apt-get install apache2
</pre></div>
</td></tr></table><p>Change the head of "/etc/apache2/sites-enabled/000-default" to:</p>
-<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span class="nt"><VirtualHost</span> <span class="s">*:880</span><span class="nt">></span>
+<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="nt"><VirtualHost</span> <span class="s">*:880</span><span class="nt">></span>
</pre></div>
</td></tr></table><p>Then, create a file /etc/apache2/sites-available/webdav:</p>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
@@ -59,7 +71,7 @@ Debian/Ubuntu.</p>
10
11
12
-13</pre></div></td><td class="code"><div class="highlight"><pre><span class="nb">Alias</span> <span class="sx">/dav</span> <span class="sx">/home/webdav/dav</span>
+13</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="nb">Alias</span> <span class="sx">/dav</span> <span class="sx">/home/webdav/dav</span>
<span class="nt"><Location</span> <span class="s">/dav</span><span class="nt">></span>
<span class="nb">Dav</span> <span class="k">on</span>
<span class="nb">Order</span> Allow,Deny
@@ -83,7 +95,7 @@ other application using webdav.</p>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
2
3
-4</pre></div></td><td class="code"><div class="highlight"><pre>sudo adduser webdav
+4</pre></div></td><td class="code"><div class="highlight"><pre><span></span>sudo adduser webdav
sudo htpasswd -c /home/webdav/.htpasswd webdav
sudo htpasswd /home/webdav/.htpasswd zotero
sudo mkdir -p /home/webdav/dav/zotero
@@ -92,7 +104,7 @@ sudo mkdir -p /home/webdav/dav/zotero
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
2
3
-4</pre></div></td><td class="code"><div class="highlight"><pre>sudo a2enmod webdav
+4</pre></div></td><td class="code"><div class="highlight"><pre><span></span>sudo a2enmod webdav
sudo a2enmod dav_fs
sudo a2ensite webdav
sudo service apache2 restart
@@ -110,7 +122,7 @@ cleaner URIs. In your desired site/location, add this:</p>
4
5
6
-7</pre></div></td><td class="code"><div class="highlight"><pre><span class="k">location</span> <span class="s">/dav</span> <span class="p">{</span>
+7</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="k">location</span> <span class="s">/dav</span> <span class="p">{</span>
<span class="kn">client_max_body_size</span> <span class="s">20M</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">X-Real-IP</span> <span class="nv">$remote_addr</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">X-Forwarded-For</span> <span class="nv">$remote_addr</span><span class="p">;</span>
@@ -119,7 +131,7 @@ cleaner URIs. In your desired site/location, add this:</p>
<span class="p">}</span>
</pre></div>
</td></tr></table><p>Now just reload nginx:</p>
-<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre>sudo service nginx force-reload
+<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span></span>sudo service nginx force-reload
</pre></div>
</td></tr></table></div>
<div class="section" id="extras">
@@ -139,7 +151,7 @@ a WSGI application with the name <em>application</em>. Hence, wsgi:a
2
3
4
-5</pre></div></td><td class="code"><div class="highlight"><pre><span class="nt"><Location</span> <span class="s">/myapp/</span><span class="nt">></span>
+5</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="nt"><Location</span> <span class="s">/myapp/</span><span class="nt">></span>
<span class="nb">ProxyPass</span> http://127.0.0.1:8888/myapp/
<span class="nb">ProxyPassReverse</span> http://127.0.0.1:8888/myapp/
<span class="nb">RequestHeader</span> set SCRIPT_NAME <span class="s2">"/myapp/"</span>
@@ -148,7 +160,7 @@ a WSGI application with the name <em>application</em>. Hence, wsgi:a
</td></tr></table><p><strong>Important</strong>: <em>SCRIPT_NAME</em> and the end of <em>ProxyPass</em> URL <strong>MUST BE
THE SAME</strong>. Otherwise, Gunicorn will fail miserably.</p>
<p>Try it with:</p>
-<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre>venv/bin/gunicorn -w <span class="m">4</span> -b 127.0.0.1:8888 --log-file - --access-logfile - wsgi:application
+<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span></span>venv/bin/gunicorn -w <span class="m">4</span> -b 127.0.0.1:8888 --log-file - --access-logfile - wsgi:application
</pre></div>
</td></tr></table></div>
<div class="section" id="uwsgi">
@@ -158,13 +170,13 @@ options for uwsgi (in a .ini file).</p>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
2
3
-4</pre></div></td><td class="code"><div class="highlight"><pre><span class="nt"><Location</span> <span class="s">/myapp/</span><span class="nt">></span>
+4</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="nt"><Location</span> <span class="s">/myapp/</span><span class="nt">></span>
<span class="nb">SetHandler</span> uwsgi_handler
<span class="nb">uWSGISocker</span> <span class="m">127.0.0.1</span>:8888
<span class="nt"></Location></span>
</pre></div>
</td></tr></table><p>Try it with:</p>
-<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre>uwsgi --socket 127.0.0.1:8888 -w wsgi:application
+<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span></span>uwsgi --socket 127.0.0.1:8888 -w wsgi:application
</pre></div>
</td></tr></table><div class="section" id="extra-supervisor">
<h3>Extra: Supervisor</h3>
@@ -188,7 +200,7 @@ supervisor config file and let it handle the server for you.</p>
16
17
18
-19</pre></div></td><td class="code"><div class="highlight"><pre><span class="k">[unix_http_server]</span>
+19</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="k">[unix_http_server]</span>
<span class="na">file</span><span class="o">=</span><span class="s">/tmp/myapp.sock ; path to your socket file</span>
<span class="k">[supervisord]</span>
@@ -238,7 +250,7 @@ memorability over describing the functionality.</p>
10
11
12
-13</pre></div></td><td class="code"><div class="highlight"><pre><span class="err">[distutils]</span> <span class="c1"># this tells distutils what package indexes you can push to</span>
+13</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="err">[distutils]</span> <span class="c1"># this tells distutils what package indexes you can push to</span>
<span class="na">index-servers</span> <span class="o">=</span><span class="s"></span>
<span class="s"> pypi # the live PyPI</span>
<span class="s"> pypitest # test PyPI</span>
@@ -276,7 +288,7 @@ root-dir/ # Any name you want
<div class="section" id="setup-cfg">
<h3>setup.cfg</h3>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
-2</pre></div></td><td class="code"><div class="highlight"><pre><span class="k">[metadata]</span>
+2</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="k">[metadata]</span>
<span class="na">description-file</span> <span class="o">=</span> <span class="s">README.md</span>
</pre></div>
</td></tr></table><p>The markdown README is the <em>de facto</em> standard in Github, but you can
@@ -295,7 +307,7 @@ also use rST (reStructuredText), the standard in the python community.</p>
9
10
11
-12</pre></div></td><td class="code"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">distutils.core</span> <span class="kn">import</span> <span class="n">setup</span>
+12</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">distutils.core</span> <span class="kn">import</span> <span class="n">setup</span>
<span class="n">setup</span><span class="p">(</span><span class="n">name</span> <span class="o">=</span> <span class="s1">'mypackage'</span><span class="p">,</span>
<span class="n">packages</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'mypackage'</span><span class="p">],</span> <span class="c1"># this must be the same as the name above</span>
@@ -313,7 +325,7 @@ host our package anywhere, but Github is a convenient option. To create
the tarball and the zip packages, you only need to tag a tag in your
repository and push it to github:</p>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
-2</pre></div></td><td class="code"><div class="highlight"><pre>git tag <span class="o">{</span>version<span class="o">}</span> -m <span class="s2">"{ Description of this tag/version}"</span>
+2</pre></div></td><td class="code"><div class="highlight"><pre><span></span>git tag <span class="o">{</span>version<span class="o">}</span> -m <span class="s2">"{ Description of this tag/version}"</span>
git push --tags origin master
</pre></div>
</td></tr></table></div>
@@ -351,7 +363,7 @@ new technologies and improve it:</p>
<p>The result can be <a class="reference external" href="http://eurolovemap.herokuapp.com/">seen here</a>.</p>
<div class="section" id="publishing-a-python-3-app-on-heroku">
<h2>Publishing a Python 3 app on Heroku</h2>
-<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre>mkvirtualenv -p /usr/bin/python3.3 eurolovemap
+<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span></span>mkvirtualenv -p /usr/bin/python3.3 eurolovemap
</pre></div>
</td></tr></table><p>Since Heroku uses python 2.7 by default, we have to tell it which
version we want, although it supports python 3.4 as well. I couldn't get
@@ -360,7 +372,7 @@ python 3.4 working using the
so I used python 3.3 instead, which works fine but is not officially
supported. Just create a file named <em>runtime.txt</em> in your project root,
with the python version you want to use:</p>
-<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre>python-3.3.1
+<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span></span>python-3.3.1
</pre></div>
</td></tr></table><p>Don't forget to freeze your dependencies so Heroku can install them:
<tt class="docutils literal">bash pip freze > requirements.txt</tt></p>
@@ -377,7 +389,7 @@ cipher</a>. Please, don't
use it for any serious application if you are concerned about being
spammed.</p>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
-2</pre></div></td><td class="code"><div class="highlight"><pre><span class="k">def</span> <span class="nf">blur_email</span><span class="p">(</span><span class="n">email</span><span class="p">):</span>
+2</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">blur_email</span><span class="p">(</span><span class="n">email</span><span class="p">):</span>
<span class="k">return</span> <span class="s2">""</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="nb">chr</span><span class="p">(</span><span class="nb">ord</span><span class="p">(</span><span class="n">i</span><span class="p">)</span><span class="o">+</span><span class="mi">5</span><span class="p">)</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">email</span><span class="p">])</span>
</pre></div>
</td></tr></table><p>And this is the client side:</p>
@@ -392,7 +404,7 @@ spammed.</p>
9
10
11
-12</pre></div></td><td class="code"><div class="highlight"><pre><span class="nb">window</span><span class="p">.</span><span class="nx">onload</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(){</span>
+12</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="nb">window</span><span class="p">.</span><span class="nx">onload</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(){</span>
<span class="nx">elems</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementsByClassName</span><span class="p">(</span><span class="s1">'profile-email'</span><span class="p">);</span>
<span class="k">for</span><span class="p">(</span><span class="kd">var</span> <span class="nx">e</span> <span class="k">in</span> <span class="nx">elems</span><span class="p">){</span>
<span class="kd">var</span> <span class="nx">blur</span> <span class="o">=</span> <span class="nx">elems</span><span class="p">[</span><span class="nx">e</span><span class="p">].</span><span class="nx">innerHTML</span><span class="p">;</span>
@@ -436,7 +448,7 @@ the <a class="reference external" href="http://slipsum.com/">Samuel L. Jac
</div>
Remove git files with globbing 2013-08-22T23:14:00+02:00 J. Fernando Sánchez tag:balkian.com,2013-08-22:remove-git-files-with-globbing.html <p>A simple trick. If you want to remove all the '.swp' files from a git
repository, just use:</p>
-<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre>git rm --cached <span class="s1">'\*\*.swp'</span>
+<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span></span>git rm --cached <span class="s1">'\*\*.swp'</span>
</pre></div>
</td></tr></table> Creating my web 2013-08-22T14:14:22+02:00 J. Fernando Sánchez tag:balkian.com,2013-08-22:creating-my-web.html <p>Finally, I've decided to set up a decent personal page. I have settled
for github-pages because I like the idea of keeping my site in a
@@ -466,7 +478,7 @@ on Github</a>. You can
clone and deploy it easily like this:</p>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
2
-3</pre></div></td><td class="code"><div class="highlight"><pre>git clone
+3</pre></div></td><td class="code"><div class="highlight"><pre><span></span>git clone
https://github.com/balkian/balkian.github.com <span class="nb">cd</span> balkian.github.com
jekyll serve -w
</pre></div>
diff --git a/feeds/cheats.atom.xml b/feeds/cheats.atom.xml
index 4137e11..9c9196f 100644
--- a/feeds/cheats.atom.xml
+++ b/feeds/cheats.atom.xml
@@ -3,13 +3,13 @@
<h2>Black screen and LightDM doesn't unlock</h2>
<p>Add this to your <cite>/etc/lightdm/lightdm.conf</cite> file:</p>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
-2</pre></div></td><td class="code"><div class="highlight"><pre><span class="k">[LightDM]</span>
+2</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="k">[LightDM]</span>
<span class="na">logind-check-graphical</span><span class="o">=</span><span class="s">true</span>
</pre></div>
</td></tr></table></div>
Org-mode tricks 2015-12-10T11:34:00+01:00 J. Fernando Sánchez tag:balkian.com,2015-12-10:org-mode-tricks.html <div class="section" id="show-plain-text-version">
<h2>Show plain text version</h2>
-<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span class="p">(</span><span class="nv">font-lock-mode</span><span class="p">)</span>
+<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="p">(</span><span class="nv">font-lock-mode</span><span class="p">)</span>
</pre></div>
</td></tr></table></div>
\ No newline at end of file
diff --git a/feeds/misc.atom.xml b/feeds/misc.atom.xml
index d67c63e..ac1221c 100644
--- a/feeds/misc.atom.xml
+++ b/feeds/misc.atom.xml
@@ -1,18 +1,30 @@
-balkian.com http://balkian.com/ 2015-04-10T17:47:00+02:00 Sharing dotfiles 2015-04-10T17:47:00+02:00 J. Fernando Sánchez tag:balkian.com,2015-04-10:sharing-dotfiles.html <p>Today's post is half a quick note, half public shaming. In other words, it is a reminder to be very careful with OAuth tokens and passwords.</p>
+balkian.com http://balkian.com/ 2016-09-28T18:47:00+02:00 Progress bars in python 2016-09-28T18:47:00+02:00 J. Fernando Sánchez tag:balkian.com,2016-09-28:progress-bars-in-python.html <p><a class="reference external" href="https://github.com/noamraph/tqdm">tqdm</a> is a nice way to add progress bars in the command line or in a jupyter notebook.</p>
+<img alt="" src="https://camo.githubusercontent.com/48838faaa8d00ea297f18e5bf55d3c6bb4e0ba6b/68747470733a2f2f692e696d6775722e636f6d2f686539417735432e676966" />
+<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
+2
+3
+4
+5</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">tqdm</span> <span class="kn">import</span> <span class="n">tqdm</span>
+<span class="kn">import</span> <span class="nn">time</span>
+
+<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">tqdm</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="mi">100</span><span class="p">)):</span>
+ <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
+</pre></div>
+</td></tr></table> Sharing dotfiles 2015-04-10T17:47:00+02:00 J. Fernando Sánchez tag:balkian.com,2015-04-10:sharing-dotfiles.html <p>Today's post is half a quick note, half public shaming. In other words, it is a reminder to be very careful with OAuth tokens and passwords.</p>
<p>As part of moving to emacs, I starting using the incredibly useful <a class="reference external" href="https://github.com/defunkt/gist.el">gh.el</a>.
When you first use it, the extension saves either your password or an OAuth token in your .gitconfig file.
This is cool and convenient, unless you <a class="reference external" href="https://github.com/balkian/dotfiles">happen to be publishing your .gitconfig file in a public repo</a>.</p>
<p>So, how can you still share your gitconfig without sharing your password/token with the rest of the world?
Since Git 1.7.0, you can <a class="reference external" href="http://stackoverflow.com/questions/1557183/is-it-possible-to-include-a-file-in-your-gitconfig">include other files in your gitconfig</a>.</p>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
-2</pre></div></td><td class="code"><div class="highlight"><pre>[include]
+2</pre></div></td><td class="code"><div class="highlight"><pre><span></span>[include]
path = ~/.gitconfig_secret
</pre></div>
</td></tr></table><p>And now, in your .gitconfig_secret file, you just have to add this:</p>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
2
-3</pre></div></td><td class="code"><div class="highlight"><pre>[github]
+3</pre></div></td><td class="code"><div class="highlight"><pre><span></span>[github]
user = balkian
token = "< Your secret token >"
</pre></div>
@@ -28,10 +40,10 @@ Debian/Ubuntu.</p>
<div class="section" id="setting-up-apache">
<h2>Setting up Apache</h2>
<p>First we need to install Apache:</p>
-<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre>sudo apt-get install apache2
+<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span></span>sudo apt-get install apache2
</pre></div>
</td></tr></table><p>Change the head of "/etc/apache2/sites-enabled/000-default" to:</p>
-<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span class="nt"><VirtualHost</span> <span class="s">*:880</span><span class="nt">></span>
+<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="nt"><VirtualHost</span> <span class="s">*:880</span><span class="nt">></span>
</pre></div>
</td></tr></table><p>Then, create a file /etc/apache2/sites-available/webdav:</p>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
@@ -46,7 +58,7 @@ Debian/Ubuntu.</p>
10
11
12
-13</pre></div></td><td class="code"><div class="highlight"><pre><span class="nb">Alias</span> <span class="sx">/dav</span> <span class="sx">/home/webdav/dav</span>
+13</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="nb">Alias</span> <span class="sx">/dav</span> <span class="sx">/home/webdav/dav</span>
<span class="nt"><Location</span> <span class="s">/dav</span><span class="nt">></span>
<span class="nb">Dav</span> <span class="k">on</span>
<span class="nb">Order</span> Allow,Deny
@@ -70,7 +82,7 @@ other application using webdav.</p>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
2
3
-4</pre></div></td><td class="code"><div class="highlight"><pre>sudo adduser webdav
+4</pre></div></td><td class="code"><div class="highlight"><pre><span></span>sudo adduser webdav
sudo htpasswd -c /home/webdav/.htpasswd webdav
sudo htpasswd /home/webdav/.htpasswd zotero
sudo mkdir -p /home/webdav/dav/zotero
@@ -79,7 +91,7 @@ sudo mkdir -p /home/webdav/dav/zotero
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
2
3
-4</pre></div></td><td class="code"><div class="highlight"><pre>sudo a2enmod webdav
+4</pre></div></td><td class="code"><div class="highlight"><pre><span></span>sudo a2enmod webdav
sudo a2enmod dav_fs
sudo a2ensite webdav
sudo service apache2 restart
@@ -97,7 +109,7 @@ cleaner URIs. In your desired site/location, add this:</p>
4
5
6
-7</pre></div></td><td class="code"><div class="highlight"><pre><span class="k">location</span> <span class="s">/dav</span> <span class="p">{</span>
+7</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="k">location</span> <span class="s">/dav</span> <span class="p">{</span>
<span class="kn">client_max_body_size</span> <span class="s">20M</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">X-Real-IP</span> <span class="nv">$remote_addr</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">X-Forwarded-For</span> <span class="nv">$remote_addr</span><span class="p">;</span>
@@ -106,7 +118,7 @@ cleaner URIs. In your desired site/location, add this:</p>
<span class="p">}</span>
</pre></div>
</td></tr></table><p>Now just reload nginx:</p>
-<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre>sudo service nginx force-reload
+<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span></span>sudo service nginx force-reload
</pre></div>
</td></tr></table></div>
<div class="section" id="extras">
@@ -126,7 +138,7 @@ a WSGI application with the name <em>application</em>. Hence, wsgi:a
2
3
4
-5</pre></div></td><td class="code"><div class="highlight"><pre><span class="nt"><Location</span> <span class="s">/myapp/</span><span class="nt">></span>
+5</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="nt"><Location</span> <span class="s">/myapp/</span><span class="nt">></span>
<span class="nb">ProxyPass</span> http://127.0.0.1:8888/myapp/
<span class="nb">ProxyPassReverse</span> http://127.0.0.1:8888/myapp/
<span class="nb">RequestHeader</span> set SCRIPT_NAME <span class="s2">"/myapp/"</span>
@@ -135,7 +147,7 @@ a WSGI application with the name <em>application</em>. Hence, wsgi:a
</td></tr></table><p><strong>Important</strong>: <em>SCRIPT_NAME</em> and the end of <em>ProxyPass</em> URL <strong>MUST BE
THE SAME</strong>. Otherwise, Gunicorn will fail miserably.</p>
<p>Try it with:</p>
-<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre>venv/bin/gunicorn -w <span class="m">4</span> -b 127.0.0.1:8888 --log-file - --access-logfile - wsgi:application
+<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span></span>venv/bin/gunicorn -w <span class="m">4</span> -b 127.0.0.1:8888 --log-file - --access-logfile - wsgi:application
</pre></div>
</td></tr></table></div>
<div class="section" id="uwsgi">
@@ -145,13 +157,13 @@ options for uwsgi (in a .ini file).</p>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
2
3
-4</pre></div></td><td class="code"><div class="highlight"><pre><span class="nt"><Location</span> <span class="s">/myapp/</span><span class="nt">></span>
+4</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="nt"><Location</span> <span class="s">/myapp/</span><span class="nt">></span>
<span class="nb">SetHandler</span> uwsgi_handler
<span class="nb">uWSGISocker</span> <span class="m">127.0.0.1</span>:8888
<span class="nt"></Location></span>
</pre></div>
</td></tr></table><p>Try it with:</p>
-<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre>uwsgi --socket 127.0.0.1:8888 -w wsgi:application
+<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span></span>uwsgi --socket 127.0.0.1:8888 -w wsgi:application
</pre></div>
</td></tr></table><div class="section" id="extra-supervisor">
<h3>Extra: Supervisor</h3>
@@ -175,7 +187,7 @@ supervisor config file and let it handle the server for you.</p>
16
17
18
-19</pre></div></td><td class="code"><div class="highlight"><pre><span class="k">[unix_http_server]</span>
+19</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="k">[unix_http_server]</span>
<span class="na">file</span><span class="o">=</span><span class="s">/tmp/myapp.sock ; path to your socket file</span>
<span class="k">[supervisord]</span>
@@ -225,7 +237,7 @@ memorability over describing the functionality.</p>
10
11
12
-13</pre></div></td><td class="code"><div class="highlight"><pre><span class="err">[distutils]</span> <span class="c1"># this tells distutils what package indexes you can push to</span>
+13</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="err">[distutils]</span> <span class="c1"># this tells distutils what package indexes you can push to</span>
<span class="na">index-servers</span> <span class="o">=</span><span class="s"></span>
<span class="s"> pypi # the live PyPI</span>
<span class="s"> pypitest # test PyPI</span>
@@ -263,7 +275,7 @@ root-dir/ # Any name you want
<div class="section" id="setup-cfg">
<h3>setup.cfg</h3>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
-2</pre></div></td><td class="code"><div class="highlight"><pre><span class="k">[metadata]</span>
+2</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="k">[metadata]</span>
<span class="na">description-file</span> <span class="o">=</span> <span class="s">README.md</span>
</pre></div>
</td></tr></table><p>The markdown README is the <em>de facto</em> standard in Github, but you can
@@ -282,7 +294,7 @@ also use rST (reStructuredText), the standard in the python community.</p>
9
10
11
-12</pre></div></td><td class="code"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">distutils.core</span> <span class="kn">import</span> <span class="n">setup</span>
+12</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">distutils.core</span> <span class="kn">import</span> <span class="n">setup</span>
<span class="n">setup</span><span class="p">(</span><span class="n">name</span> <span class="o">=</span> <span class="s1">'mypackage'</span><span class="p">,</span>
<span class="n">packages</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'mypackage'</span><span class="p">],</span> <span class="c1"># this must be the same as the name above</span>
@@ -300,7 +312,7 @@ host our package anywhere, but Github is a convenient option. To create
the tarball and the zip packages, you only need to tag a tag in your
repository and push it to github:</p>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
-2</pre></div></td><td class="code"><div class="highlight"><pre>git tag <span class="o">{</span>version<span class="o">}</span> -m <span class="s2">"{ Description of this tag/version}"</span>
+2</pre></div></td><td class="code"><div class="highlight"><pre><span></span>git tag <span class="o">{</span>version<span class="o">}</span> -m <span class="s2">"{ Description of this tag/version}"</span>
git push --tags origin master
</pre></div>
</td></tr></table></div>
@@ -338,7 +350,7 @@ new technologies and improve it:</p>
<p>The result can be <a class="reference external" href="http://eurolovemap.herokuapp.com/">seen here</a>.</p>
<div class="section" id="publishing-a-python-3-app-on-heroku">
<h2>Publishing a Python 3 app on Heroku</h2>
-<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre>mkvirtualenv -p /usr/bin/python3.3 eurolovemap
+<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span></span>mkvirtualenv -p /usr/bin/python3.3 eurolovemap
</pre></div>
</td></tr></table><p>Since Heroku uses python 2.7 by default, we have to tell it which
version we want, although it supports python 3.4 as well. I couldn't get
@@ -347,7 +359,7 @@ python 3.4 working using the
so I used python 3.3 instead, which works fine but is not officially
supported. Just create a file named <em>runtime.txt</em> in your project root,
with the python version you want to use:</p>
-<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre>python-3.3.1
+<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span></span>python-3.3.1
</pre></div>
</td></tr></table><p>Don't forget to freeze your dependencies so Heroku can install them:
<tt class="docutils literal">bash pip freze > requirements.txt</tt></p>
@@ -364,7 +376,7 @@ cipher</a>. Please, don't
use it for any serious application if you are concerned about being
spammed.</p>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
-2</pre></div></td><td class="code"><div class="highlight"><pre><span class="k">def</span> <span class="nf">blur_email</span><span class="p">(</span><span class="n">email</span><span class="p">):</span>
+2</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">blur_email</span><span class="p">(</span><span class="n">email</span><span class="p">):</span>
<span class="k">return</span> <span class="s2">""</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="nb">chr</span><span class="p">(</span><span class="nb">ord</span><span class="p">(</span><span class="n">i</span><span class="p">)</span><span class="o">+</span><span class="mi">5</span><span class="p">)</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">email</span><span class="p">])</span>
</pre></div>
</td></tr></table><p>And this is the client side:</p>
@@ -379,7 +391,7 @@ spammed.</p>
9
10
11
-12</pre></div></td><td class="code"><div class="highlight"><pre><span class="nb">window</span><span class="p">.</span><span class="nx">onload</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(){</span>
+12</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="nb">window</span><span class="p">.</span><span class="nx">onload</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(){</span>
<span class="nx">elems</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementsByClassName</span><span class="p">(</span><span class="s1">'profile-email'</span><span class="p">);</span>
<span class="k">for</span><span class="p">(</span><span class="kd">var</span> <span class="nx">e</span> <span class="k">in</span> <span class="nx">elems</span><span class="p">){</span>
<span class="kd">var</span> <span class="nx">blur</span> <span class="o">=</span> <span class="nx">elems</span><span class="p">[</span><span class="nx">e</span><span class="p">].</span><span class="nx">innerHTML</span><span class="p">;</span>
@@ -423,7 +435,7 @@ the <a class="reference external" href="http://slipsum.com/">Samuel L. Jac
</div>
Remove git files with globbing 2013-08-22T23:14:00+02:00 J. Fernando Sánchez tag:balkian.com,2013-08-22:remove-git-files-with-globbing.html <p>A simple trick. If you want to remove all the '.swp' files from a git
repository, just use:</p>
-<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre>git rm --cached <span class="s1">'\*\*.swp'</span>
+<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span></span>git rm --cached <span class="s1">'\*\*.swp'</span>
</pre></div>
</td></tr></table> Creating my web 2013-08-22T14:14:22+02:00 J. Fernando Sánchez tag:balkian.com,2013-08-22:creating-my-web.html <p>Finally, I've decided to set up a decent personal page. I have settled
for github-pages because I like the idea of keeping my site in a
@@ -453,7 +465,7 @@ on Github</a>. You can
clone and deploy it easily like this:</p>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
2
-3</pre></div></td><td class="code"><div class="highlight"><pre>git clone
+3</pre></div></td><td class="code"><div class="highlight"><pre><span></span>git clone
https://github.com/balkian/balkian.github.com <span class="nb">cd</span> balkian.github.com
jekyll serve -w
</pre></div>
diff --git a/index.html b/index.html
index 40463b9..138eb99 100644
--- a/index.html
+++ b/index.html
@@ -89,6 +89,8 @@
@@ -126,6 +122,27 @@
+
+
+
2016-09-28
+
python
+
+
+
tqdm is a nice way to add progress bars in the command line or in a jupyter notebook.
+
+
from tqdm import tqdm
+import time
+
+for i in tqdm ( range ( 100 )):
+ time . sleep ( 1 )
+
+
+
+
2016-02-03
@@ -137,7 +154,7 @@
Black screen and LightDM doesn't unlock
Add this to your /etc/lightdm/lightdm.conf file:
[LightDM]
logind-check-graphical = true
@@ -155,7 +172,7 @@
Show plain text version
-
@@ -209,7 +226,7 @@ a WSGI application with the name application . Hence, wsgi:application.<
2
3
4
-5 <Location /myapp/ >
ProxyPass http://127.0.0 ...
@@ -251,7 +268,7 @@ gathered from media in several languages. Then we aggregated ...
A simple trick. If you want to remove all the '.swp' files from a git
repository, just use:
-
git rm --cached '\*\*.swp'
+ git rm --cached '\*\*.swp'
diff --git a/org-mode-tricks.html b/org-mode-tricks.html
index bfb041a..0c5d7d0 100644
--- a/org-mode-tricks.html
+++ b/org-mode-tricks.html
@@ -91,6 +91,8 @@
@@ -137,7 +133,7 @@
Show plain text version
-
diff --git a/pages/projects.html b/pages/projects.html
index d6542ed..1103828 100644
--- a/pages/projects.html
+++ b/pages/projects.html
@@ -91,6 +91,8 @@
diff --git a/pages/to-do.html b/pages/to-do.html
index bd0f36d..5c9f52d 100644
--- a/pages/to-do.html
+++ b/pages/to-do.html
@@ -90,6 +90,8 @@
diff --git a/progress-bars-in-python.html b/progress-bars-in-python.html
new file mode 100644
index 0000000..7a11017
--- /dev/null
+++ b/progress-bars-in-python.html
@@ -0,0 +1,186 @@
+
+
+
+
+
+ balkian.com - Progress bars in python
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Progress bars in python
+
2016-09-28
+
python
+
+
+
+
tqdm is a nice way to add progress bars in the command line or in a jupyter notebook.
+
+
from tqdm import tqdm
+import time
+
+for i in tqdm ( range ( 100 )):
+ time . sleep ( 1 )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/proxies-with-apache-and-python.html b/proxies-with-apache-and-python.html
index 32f031c..9273c78 100644
--- a/proxies-with-apache-and-python.html
+++ b/proxies-with-apache-and-python.html
@@ -91,6 +91,8 @@
@@ -145,7 +141,7 @@ a WSGI application with the name application . Hence, wsgi:application.<
2
3
4
-5 <Location /myapp/ >
ProxyPass http://127.0.0.1:8888/myapp/
ProxyPassReverse http://127.0.0.1:8888/myapp/
RequestHeader set SCRIPT_NAME "/myapp/"
@@ -154,7 +150,7 @@ a WSGI application with the name application . Hence, wsgi:application.<
Important : SCRIPT_NAME and the end of ProxyPass URL MUST BE
THE SAME . Otherwise, Gunicorn will fail miserably.
Try it with:
-
venv/bin/gunicorn -w 4 -b 127.0.0.1:8888 --log-file - --access-logfile - wsgi:application
+ venv/bin/gunicorn -w 4 -b 127.0.0.1:8888 --log-file - --access-logfile - wsgi:application
@@ -164,13 +160,13 @@ options for uwsgi (in a .ini file).
<Location /myapp/ >
SetHandler uwsgi_handler
uWSGISocker 127.0.0.1 :8888
</Location>
Try it with:
-
uwsgi --socket 127.0.0.1:8888 -w wsgi:application
+ uwsgi --socket 127.0.0.1:8888 -w wsgi:application
[unix_http_server]
file = /tmp/myapp.sock ; path to your socket file
[supervisord]
diff --git a/publishing-on-pypi.html b/publishing-on-pypi.html
index eb299d3..3fec1dc 100644
--- a/publishing-on-pypi.html
+++ b/publishing-on-pypi.html
@@ -91,6 +91,8 @@
@@ -162,7 +158,7 @@ memorability over describing the functionality.
10
11
12
-13[distutils] # this tells distutils what package indexes you can push to
+13[distutils] # this tells distutils what package indexes you can push to
index-servers =
pypi # the live PyPI
pypitest # test PyPI
@@ -200,7 +196,7 @@ root-dir/ # Any name you want
setup.cfg
[metadata]
description-file = README.md
The markdown README is the de facto standard in Github, but you can
@@ -219,7 +215,7 @@ also use rST (reStructuredText), the standard in the python community.
9
10
11
-12
from distutils.core import setup
+12from distutils.core import setup
setup ( name = 'mypackage' ,
packages = [ 'mypackage' ], # this must be the same as the name above
@@ -237,7 +233,7 @@ host our package anywhere, but Github is a convenient option. To create
the tarball and the zip packages, you only need to tag a tag in your
repository and push it to github:
git tag { version} -m "{ Description of this tag/version}"
+2 git tag { version} -m "{ Description of this tag/version}"
git push --tags origin master
diff --git a/remove-git-files-with-globbing.html b/remove-git-files-with-globbing.html
index 0f10013..bbf13c2 100644
--- a/remove-git-files-with-globbing.html
+++ b/remove-git-files-with-globbing.html
@@ -91,6 +91,8 @@
@@ -134,7 +130,7 @@
A simple trick. If you want to remove all the '.swp' files from a git
repository, just use:
-
git rm --cached '\*\*.swp'
+ git rm --cached '\*\*.swp'
diff --git a/sharing-dotfiles.html b/sharing-dotfiles.html
index 83fdfba..cb1fc4f 100644
--- a/sharing-dotfiles.html
+++ b/sharing-dotfiles.html
@@ -91,6 +91,8 @@
@@ -141,13 +137,13 @@ This is cool and convenient, unless you include other files in your gitconfig .
[include]
path = ~/.gitconfig_secret
And now, in your .gitconfig_secret file, you just have to add this:
[github]
user = balkian
token = "< Your secret token >"
diff --git a/tag/apache.html b/tag/apache.html
index 618e921..aafa730 100644
--- a/tag/apache.html
+++ b/tag/apache.html
@@ -150,7 +150,7 @@ a WSGI application with the name application . Hence, wsgi:application.<
2
3
4
-5<Location /myapp/ >
ProxyPass http://127.0.0 ...
diff --git a/tag/arch.html b/tag/arch.html
index 91c3728..5c6084e 100644
--- a/tag/arch.html
+++ b/tag/arch.html
@@ -118,7 +118,7 @@
Black screen and LightDM doesn't unlock
Add this to your /etc/lightdm/lightdm.conf file:
[LightDM]
logind-check-graphical = true
diff --git a/tag/editor.html b/tag/editor.html
index e7bc574..ba4b07f 100644
--- a/tag/editor.html
+++ b/tag/editor.html
@@ -120,7 +120,7 @@
Show plain text version
-
diff --git a/tag/emacs.html b/tag/emacs.html
index b9d0091..e6344e4 100644
--- a/tag/emacs.html
+++ b/tag/emacs.html
@@ -120,7 +120,7 @@
Show plain text version
-
diff --git a/tag/git.html b/tag/git.html
index cd9bdaa..51d78c5 100644
--- a/tag/git.html
+++ b/tag/git.html
@@ -137,7 +137,7 @@ When you first use it, the extension saves either ...
A simple trick. If you want to remove all the '.swp' files from a git
repository, just use:
-
git rm --cached '\*\*.swp'
+ git rm --cached '\*\*.swp'
diff --git a/tag/gunicorn.html b/tag/gunicorn.html
index 637d221..57f8f07 100644
--- a/tag/gunicorn.html
+++ b/tag/gunicorn.html
@@ -129,7 +129,7 @@ a WSGI application with the name application . Hence, wsgi:application.<
2
3
4
-5<Location /myapp/ >
ProxyPass http://127.0.0 ...
diff --git a/tag/linux.html b/tag/linux.html
index a20c557..3924c8e 100644
--- a/tag/linux.html
+++ b/tag/linux.html
@@ -118,7 +118,7 @@
Black screen and LightDM doesn't unlock
Add this to your /etc/lightdm/lightdm.conf file:
[LightDM]
logind-check-graphical = true
diff --git a/tag/org.html b/tag/org.html
index 5d0e71e..738cbd1 100644
--- a/tag/org.html
+++ b/tag/org.html
@@ -120,7 +120,7 @@
Show plain text version
-
diff --git a/tag/productivity.html b/tag/productivity.html
index 69c63e3..d44e6a8 100644
--- a/tag/productivity.html
+++ b/tag/productivity.html
@@ -120,7 +120,7 @@
Show plain text version
-
diff --git a/tag/proxy.html b/tag/proxy.html
index 9ecf9ef..830860a 100644
--- a/tag/proxy.html
+++ b/tag/proxy.html
@@ -129,7 +129,7 @@ a WSGI application with the name application . Hence, wsgi:application.<
2
3
4
-5 <Location /myapp/ >
ProxyPass http://127.0.0 ...
diff --git a/tag/python.html b/tag/python.html
index d9edca8..3d7ba22 100644
--- a/tag/python.html
+++ b/tag/python.html
@@ -89,6 +89,8 @@
Latest entries
+ Progress bars in python
+ python
Proxies with Apache and python
python
apache
@@ -118,6 +120,27 @@
Entries tagged: python
+
+
+
2016-09-28
+
python
+
+
+
tqdm is a nice way to add progress bars in the command line or in a jupyter notebook.
+
+
from tqdm import tqdm
+import time
+
+for i in tqdm ( range ( 100 )):
+ time . sleep ( 1 )
+
+
+
+
2014-10-09
@@ -137,7 +160,7 @@ a WSGI application with the name
application . Hence, wsgi:application.<
2
3
4
-5
<Location /myapp/ >
ProxyPass http://127.0.0 ...
diff --git a/tag/uwsgi.html b/tag/uwsgi.html
index aaf6156..af06280 100644
--- a/tag/uwsgi.html
+++ b/tag/uwsgi.html
@@ -129,7 +129,7 @@ a WSGI application with the name application . Hence, wsgi:application.<
2
3
4
-5 <Location /myapp/ >
ProxyPass http://127.0.0 ...
diff --git a/tags.html b/tags.html
index e42766d..e6f4168 100644
--- a/tags.html
+++ b/tags.html
@@ -90,6 +90,8 @@
@@ -121,28 +117,28 @@
diff --git a/updating-eurolovemap.html b/updating-eurolovemap.html
index daef9fe..80c543c 100644
--- a/updating-eurolovemap.html
+++ b/updating-eurolovemap.html
@@ -91,6 +91,8 @@
@@ -158,7 +154,7 @@ new technologies and improve it:
The result can be seen here .
Publishing a Python 3 app on Heroku
-
mkvirtualenv -p /usr/bin/python3.3 eurolovemap
+ mkvirtualenv -p /usr/bin/python3.3 eurolovemap
Since Heroku uses python 2.7 by default, we have to tell it which
version we want, although it supports python 3.4 as well. I couldn't get
@@ -167,7 +163,7 @@ python 3.4 working using the
so I used python 3.3 instead, which works fine but is not officially
supported. Just create a file named runtime.txt in your project root,
with the python version you want to use:
-
python-3.3.1
+ Don't forget to freeze your dependencies so Heroku can install them:
bash pip freze > requirements.txt
@@ -184,7 +180,7 @@ cipher. Please, don't
use it for any serious application if you are concerned about being
spammed.
def blur_email ( email ):
+2def blur_email ( email ):
return "" . join ([ chr ( ord ( i ) + 5 ) for i in email ])
And this is the client side:
@@ -199,7 +195,7 @@ spammed.
9
10
11
-12
window . onload = function (){
+12window . onload = function (){
elems = document . getElementsByClassName ( 'profile-email' );
for ( var e in elems ){
var blur = elems [ e ]. innerHTML ;
diff --git a/zotero.html b/zotero.html
index a3559bd..d82f0ff 100644
--- a/zotero.html
+++ b/zotero.html
@@ -91,6 +91,8 @@
@@ -147,10 +143,10 @@ Debian/Ubuntu.
Setting up Apache
First we need to install Apache:
-
sudo apt-get install apache2
+ sudo apt-get install apache2
Change the head of "/etc/apache2/sites-enabled/000-default" to:
-
<VirtualHost *:880 >
+Then, create a file /etc/apache2/sites-available/webdav:
1
@@ -165,7 +161,7 @@ Debian/Ubuntu.
10
11
12
-13 Alias /dav /home/webdav/dav
+13Alias /dav /home/webdav/dav
<Location /dav >
Dav on
Order Allow,Deny
@@ -189,7 +185,7 @@ other application using webdav.
sudo adduser webdav
sudo htpasswd -c /home/webdav/.htpasswd webdav
sudo htpasswd /home/webdav/.htpasswd zotero
sudo mkdir -p /home/webdav/dav/zotero
@@ -198,7 +194,7 @@ sudo mkdir -p /home/webdav/dav/zotero
sudo a2enmod webdav
sudo a2enmod dav_fs
sudo a2ensite webdav
sudo service apache2 restart
@@ -216,7 +212,7 @@ cleaner URIs. In your desired site/location, add this:
4
5
6
-7location /dav {
client_max_body_size 20M ;
proxy_set_header X-Real-IP $remote_addr ;
proxy_set_header X-Forwarded-For $remote_addr ;
@@ -225,7 +221,7 @@ cleaner URIs. In your desired site/location, add this:
}
Now just reload nginx:
-
sudo service nginx force-reload
+ sudo service nginx force-reload