Bash command as startup application in Ubuntu

Finally I figured out why my bash commands in the Ubuntu startup application menu weren’t working. For example, I wanted to use this command to set up natural horizontal scrolling in firefox:

sleep 5 && synclient HorizScrollDelta=-68

What I didn’t know for a long time was that this command has to be enclosed in it’s own shell command:

sh -c "sleep 5 && synclient HorizScrollDelta=-68"

Finally I can have the zoom set for my high resolution display, enable horizontal scrolling and set up my graphics tablet automatically after login.

Unicycle conversion to Python frame geometry

Here are some images about my unicycle conversion. The discussion takes place on the Python mailing list:

https://www.freelists.org/post/python/Using-three-unicycles-as-basis-for-a-python-frame

Sitting on the back part of the frame (the silver unicycle), the whole frame flexes considerably, but comfortably.
The M12 screws which form the pivot axle are screwed directly into the plastic. It’s (probably) tight enough so that they will not loosen themselves.
The two unicycle frames are joined by four screws. The connection is very tight and there is no flexing or other movement. It would be possible to tilt the red frame up or down by a few degrees.
The front part.
Plans for the bottom bracket. The third unicycle wheel was scavenged for its axle, which will be connected to the front frame via the outer parts of the roller bearings.

Subtitles for 大闹天宫 (Havoc in Heaven)

In the attachment you can find a file I used for creating the video to be found here:

大闹天宫 with Chinese learner’s subtitles

The file attached has the following tab-separated columns:

  • The name of the movie
  • HSK level, 7 means the sentence contains non-HSK characters
  • Legacy ID; if I remember correctly it should be the ID of my former website MandarinBanana. You can ignore this column.
  • The sentence, with each character colored according to pinyin tone, and with the pinyin written under the character. You need appropriate CSS settings to make it work (colors, and display:inline-block). If you want just the sentence just delete alphanumeric characters and everything in <>, that should work. If you can’t figure this out just leave a comment.
  • This is a reference to the individual video snippet I used to keep for each sentence. It is in the format: tag (dntg) – start of sentence in ms – end of sentence in ms.
  • A table with vocabulary explanations for each word or character in the sentence. These can actually not be seen in the movie above.
  • Word-by-word translation
  • More liberal English translation of the sentence

A word of caution: English is not my native language, and this translation practice taught me that it’s actually very hard to translate into a foreign language. Many English translations will sound weird or just wrong, but it’s the best I could do. It already took me a whole weekend to translate the Chinese subtitles!

MandarinBanana is offline

Today I pulled the plug on mandarinbanana.com, mainly due to growing concerns over probably not fulfilling DSGVO legislation, no cookie popup, lacking user rights law statements and so on. I don’t want to be sued! Anyway I realized I should run a local copy on my laptop instead and be actually more flexible this way, because this way I’m independent of network connections.

Anyway, in the unlikely event that you were actually using mandarinbanana.com, sorry! MandarinBanana might come back, altough it might take a few months (or years), or I might never find the time for everything I want to do to put it back online.

MandarinBanana Mnemonics Anki Import

Today I’ve created a text file with the mnemonics from mandarinbanana.com to import in Anki. You can download the file here:

It is a tab-separated text file (compressed as zip, because it is 45 MB large uncompressed). This is what the import looks like:

Anki import screen
# / nameWhat’s inside
1 / hanziJust a single Chinese character, no HTML formatting. Example: 仍
2 / componentsA simple line showing the components (example: 仍 = 乃 + 亻), followed by dictionary entries for the components and mnemonics for the components.
3 / translationsDictionary entries for the character and any mnemonics associated with the character.
4 / imagesLinks to the comics associated with the character (no download option available so far)
5 / appearancesA list of characters which use the root character as component (example: 仍 appears in 芿)
6 / subtitlesSubtitles of the movies on mandarinbanana.com which contain the character. If you click on the sentence, it will open in the browser.
7 / wordsA list of CC-CEDICT dictionary entries for words the character appears in.

There’s a lot of HTML formatting inside. Here’s what my styling section in Anki looks like (just as an example):

.card {
 font-size: 16px;
 text-align: center;
 background: black;
 color: white;
}

.mnemonics {
  margin-top: 1em;
  padding-top: 1em;
  border-top: 1px solid gray;
}

table {
  margin-left: auto;
  margin-right: auto;
}

td {
  border: 1px solid;
  padding: 5px;
}

div {
  margin: 5px;
}

.hanzi {
font-size: 2em;
font-family: "zenhei";
}

a {
text-decoration: none;
color: inherit;
}

ul {
  list-style-type: none;
}

.mandarinbananalink a {
text-decoration: none;
color: orange;
}

img.mimage {
width: 200px;
background-color: white;
border: 1px solid white;
margin: 1px;
}

@font-face {
  font-family: uming;
  src: url('_UMingCN.ttf');
}

@font-face {
  font-family: simfang;
  src: url('_simfang.ttf');
}

@font-face {
 font-family: zenhei;
 src: url('_WenQuanYiZenHei.ttf');
}

.color1 {
color: orangered;
}

.color2 {
color: yellow;
}

.color3 {
color: limegreen;
}

.color4 {
color: dodgerblue;
}

Each mnemonic is followed by the author’s name (since all mnemonics are CC-BY). If you like to, you can hide this information by including the following code in your “Styling” section:

.authorattribution {
display: none;
}

I hope this is useful for you! If you need a different format let me know in the comments.

If you want to have a look how the file is generated, please head over to https://github.com/mattbenscho/MandarinBanana/blob/master/lib/tasks/output_anki.rake. It takes a few minutes for the script to run because there are so many database calls, which makes it difficult to, for example, post a link on mandarinbanana.com which always returns the latest collection. I’ll have to implement some caching mechanism first, but it’s one of the things I definitely want to do to complete the site.

Have fun learning Chinese!

Copyright information: all mnemonics CC-BY by the respective authors. Dictionary entries: CC-SA CC-CEDICT (www.mdbg.com).

Controlling Ankidroid with a Joycon

This post is kind of an addendum to my previous post, but it’s about controlling Ankidroid. You’ll need the app “External keyboard helper pro” (about $2). Here are the steps:

  1. Press the sync button on the Joycon and pair it with your Android device.
  2. Open “EKH Settings”, go to “Advanced settings”, “Keyboard mapping”, “Customize keyboard mappings”, and click on “Add new key mapping” for each button you want to map. For Example, I have SL and SR mapped to 0 and space respectively as in my previous post.
  3. Open Ankidroid and enjoy flipping your cards with your Joycon! You’ll have to set External Keyboard Helper as input method before.

More info on using the buttons on your headphones (similar approach): https://github.com/ankidroid/Anki-Android/issues/3021#issuecomment-160243369