https://tbrink.science/
Tobias Brink
2021-09-12T16:51:25+00:00
Tobias Brink
mail@tbrink.science
https://tbrink.science/favicon.svg
© 2017–2021, Tobias Brink
Welcome to the personal blog of Tobias Brink. I write mostly about computational materials science and related topics, such as programming and the software we use. This includes Python, LAMMPS, Ovito, LaTeX, C++, ASE, and whatever else helps in our research. This site also contains links to publications I (co-)authored and some code I wrote.
https://tbrink.science/blog/2021/05/18/only-sound-on-left-channel-from-microphone-connected-to-usb-audio-interface/
Only sound on left channel from microphone connected to USB audio interface
2021-05-18T21:19:32+02:00
2021-05-18T21:19:32+02:00
<p>If you record sound from a microphone connected to a <span class="allcaps">USB</span> audio
interface, it might be that you only get an input signal on the left
stereo channel. This is because the second input on the audio
interface goes into the right channel, a behaviour that seems to be
common for audio interfaces with two input channels. For recording
audio, this is not a problem since you can reassign this in any audio
editor. Video call software might also work, since it probably
downsamples the input to mono, so you could be fine. Nevertheless, it
is annoying and can lead to noise from the second, unconnected input
to be picked up. Here, I’m telling you how to extract the correct
inputs cleanly in Pulseaudio on Linux so that it can be used by any
software.</p>
CC BY-SA 4.0
https://tbrink.science/blog/2021/05/15/recording-audio-and-video-for-amateurs/
Recording audio and video for amateurs
2021-05-15T18:37:40+02:00
2021-05-18T21:19:32+02:00
<p>During the pandemic, conferences and meetings had to move online. As
scientists, we are increasingly asked to pre-record presentations
ourselves. This is new ground for many of us. Recently, I have also
become dissatisfied with the quality of the built-in laptop
microphone, even for video calls. While the camera is also bad, this
does not matter as much for a video call and a recorded presentation
will only have a small image of me in some corner. So here are some
notes of what I learned about recording videos and how I tried to
improve the audio quality. No guarantees for correctness, I am also
an amateur. Everything is done on Linux using free software, which
should also be available on Windows and Mac. Possibly subject to
updates in the future.</p>
CC BY-SA 4.0
https://tbrink.science/blog/2019/05/12/adhesive-wear-mechanisms-in-the-presence-of-weak-interfaces/
Adhesive wear mechanisms in the presence of weak interfaces: Insights from an amorphous model system
2019-05-12T09:32:50+02:00
2019-05-12T09:32:50+02:00
<p>Whenever surfaces in contact slide relative to each other, they wear
and emit particles. Understanding this process at the microscopic
scale is an important piece of the puzzle to figuring out how exactly
materials and parts wear out and to ultimately extend their useful
lifetime. In our efforts in the <a href="https://lsms.epfl.ch/">Computational Solid Mechanics
Laboratory</a> at <a href="https://epfl.ch/"><span class="allcaps">EPFL</span></a> to
tackle the problem of wear—as a part of the field of
<a href="https://en.wikipedia.org/wiki/Tribology">tribology</a>—we used
<a href="https://en.wikipedia.org/wiki/Molecular_dynamics">molecular dynamics
(<span class="allcaps">MD</span>)</a> simulations to
understand the creation of wear particles when the adhesion between
the surfaces is reduced—a case that is in fact expected in most
material contacts. The work shows at the microscopic level why flatter
surfaces are more amenable to slip and low wear and, conversely, wear
particles result more easily from high-angle asperity collisions on
rougher surfaces. All of this can be described by a predictive,
analytical model at the asperity level based on interface properties
and roughness parameters.</p>
CC BY-SA 4.0
https://tbrink.science/blog/2018/05/21/creating-sitemap-xml-with-jekyll-using-git-data/
Creating sitemap.xml with Jekyll using git data
2018-05-21T22:14:43+02:00
2018-05-21T22:14:43+02:00
<p>The <a href="https://www.sitemaps.org/"><code class="language-plaintext highlighter-rouge">sitemap.xml</code> file</a> is used to let
search engines know the content of your website for indexing. You can
create a sitemap automatically using the <a href="https://github.com/jekyll/jekyll-sitemap">official Jekyll sitemap
plugin</a>. I keep my blog in a
git repository, so I thought I could do better for updating the
<code class="language-plaintext highlighter-rouge"><lastmod></code> tag, which indicates when the page was last changed. The
official plugin needs an explicit date in the front matter (which is
tedious to maintain correctly) or it will use the file modification
time. Git does not preserve file modification times, so this method
will get confused when checking out the repository on another
computer. Instead, I wanted to use the git metadata, which more
accurately records when the file was last changed.</p>
CC BY-SA 4.0
https://tbrink.science/blog/2018/05/13/lossy-compression-for-pdfs/
Lossy compression for PDFs
2018-05-13T11:21:12+02:00
2018-05-13T11:21:12+02:00
<p>Sometimes you need to make an existing <span class="allcaps">PDF</span> smaller quickly. Either you
miss the source for the file, or it is a lot of hassle to find the
offending large objects. If large, high-resolution images are the
cause of large <span class="allcaps">PDF</span> files, <a href="https://ghostscript.com/">Ghostscript</a> can
help compress them, sacrificing image quality for size (although the
results should still be acceptable).</p>
CC BY-SA 4.0
https://tbrink.science/blog/2018/05/10/custom-fading-in-tikz/
Custom fading in TikZ
2018-05-10T21:04:14+02:00
2018-05-10T21:04:14+02:00
<p><a href="https://en.wikipedia.org/wiki/PGF/TikZ">TikZ</a>, a drawing library for
LaTeX, has some built-in options to fade a path. Sometimes, though,
much more control is needed. For this, custom fadings can be defined,
but there are some caveats that do not seem to be mentioned in the
manual. The following recipe is tested with TikZ version 3.0.1.</p>
CC BY-SA 4.0
https://tbrink.science/blog/2017/10/04/e-mail-access-a-relayhost-through-ssh-with-postfix/
E-mail: Access a relayhost through SSH with Postfix
2017-10-04T21:49:26+02:00
2017-10-04T21:49:26+02:00
<p>Sometimes, an <span class="allcaps">SMTP</span> server is only accessible from a local <span class="allcaps">LAN.</span> If you
have a Linux computer and an <span class="allcaps">SSH</span> account inside of this <span class="allcaps">LAN</span>, you can
nevertheless tunnel through and send e-mails from anywhere. There are
several ways to do this and I found one that is transparent to my
current setup.</p>
CC BY-SA 4.0
https://tbrink.science/blog/2017/07/15/count-the-number-of-colour-pages-in-a-pdf/
Count the number of colour pages in a PDF
2017-07-15T23:37:35+02:00
2017-07-15T23:37:35+02:00
<p>For printing (e.g. a thesis), it might be cheaper to print some pages
in black and white instead of colour. Printers’ web sites often ask
you to put in the number of colour pages. To avoid counting by hand
you can use <a href="https://www.ghostscript.com/">ghostscript</a>, which should
be installed on all normal desktop Linux systems.</p>
CC BY-SA 4.0
https://tbrink.science/blog/2017/06/20/converting-privileged-lxc-containers-to-unprivileged-containers/
Converting privileged LXC containers to unprivileged containers
2017-06-20T23:38:53+02:00
2017-08-02T11:39:13+02:00
<p>I use <a href="https://linuxcontainers.org/"><span class="allcaps">LXC</span></a> (Linux Containers) on a
small server to host several Linuxes on the same hardware. While
upgrading to the recently released <a href="https://www.debian.org/">Debian</a>
Stretch and reviewing the configuration, I thought I should really
make these containers unprivileged. What does that mean? Usually, <span class="allcaps">LXC</span>
containers use the same
<a href="https://en.wikipedia.org/wiki/User_identifier"><span class="allcaps">UID</span></a> namespace as the
host, i.e., root inside the container is root outside the
container. This is obviously not optimal, since any bug which allows a
breakout from the container may allow an attacker to have the same
privileges on the host as inside of the container. Even worse, the <span class="allcaps">UID</span>
to name mapping can differ between container and host. <span class="allcaps">UID</span> 1000, for
example, could be “alice” on the host and “bob” in the container. This
can give users on the host too much access to the container’s file
system. Luckily, <span class="allcaps">LXC</span> has a solution: <span class="allcaps">UID</span> mappings.</p>
CC BY-SA 4.0
https://tbrink.science/blog/2017/06/15/running-git-from-a-git-hook/
Running git from a git hook
2017-06-15T17:18:52+02:00
2017-06-15T17:18:52+02:00
<p>When you want to run the <code class="language-plaintext highlighter-rouge">git</code> command from a git hook, this will
(can?) fail with the message <code class="language-plaintext highlighter-rouge">fatal: Not a git repository: '.'</code>. The
reason is very simple: The <code class="language-plaintext highlighter-rouge">GIT_DIR</code> environment variable is set and
confuses the child <code class="language-plaintext highlighter-rouge">git</code>. You need to unset the <code class="language-plaintext highlighter-rouge">GIT_*</code> variables
before running a child git.</p>
CC BY-SA 4.0