I recently played around with scraping public Telegram channels and finally want to do something with the data. In particular, I wanted to play around with Named Entity Recognition (NER) and Sentiment Analysis on the content of the Telegram posts. I think this will probably work much better when you do it for each language separately. So before we answer the question "what's this post about?" or "how angry is the person in the post?", let's answer the question "what language is the post in?" first. And we'll do it while warming up with that hole machine learning (ML) topic. Be aware: I have no idea what I'm doing. Do you want to know more?
As I [have hinted at before](/2017/09/20/just-some-friendly-advice/), the [PyCrypto library](https://www.dlitz.net/software/pycrypto/) [seems to be dead](https://github.com/dlitz/pycrypto/issues/173). The [PyCryptodome](https://www.pycryptodome.org/en/latest/) library is a fork that is promising because it is maintained and works in Python 3, but they have a bit of a finger-wagging attitude which sometimes means that you have to fight the library a bit:
They certainly mean well, but the library is no place to impose security standards, in my opinion. In malware research for example, we often have to verbatim copy the appalling use of certain ciphers, like ARC4 with a 4-byte key. It happens all the time! I have been particularly struggling with [the removal of the XOR cipher](https://pycryptodome.readthedocs.io/en/latest/src/vs_pycrypto.html). The XOR implementation of PyCrypto was very fast, and in this article I will both benchmark how fast exactly it was and give you a drop-in replacement which degrades gracefully based on your options. Do you want to know more?
>>> from Crypto.Cipher import ARC4 >>> cipher = ARC4.new(B'funk') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python37\lib\site-packages\Crypto\Cipher\ARC4.py", line 132, in new return ARC4Cipher(key, *args, **kwargs) File "C:\Python37\lib\site-packages\Crypto\Cipher\ARC4.py", line 57, in __init__ len(key)) ValueError: Incorrect ARC4 key length (4 bytes) >>> ARC4.key_size = range(1,257) >>> ARC4.new(B'funk').decrypt( ARC4.new(B'funk').encrypt( B'Hello World' )) b'Hello World'
So you develop in [Microsoft Visual Studio Community Edition](https://www.visualstudio.com/de/vs/community/) and you long for the old days when there was a way to get the [MSDN Library](https://msdn.microsoft.com/en-us/library/) as an offline help file? Fear not, you still can. Open Visual Studio, type
Qto open the quick access bar, usually located in the upper right corner of your interface. Enter
Help Viewer, it should yield one result by that name, marked as an *"individual component"*. Selecting that entry should allow you to download and install the Help Viewer. Now relaunch Visual Studio and start the Help Viewer via quick access in the same way. You will be prompted whether you want to download some *content* - and I bet you do.
Part of me wants to write about all the [horror](https://www.bleepingcomputer.com/news/security/ten-malicious-libraries-found-on-pypi-python-package-index/) and [glory](https://crates.io) there is to be seen in package management, but quite frankly it'll take too long. Instead, I will just leave you with a tiny piece of advice. Here comes. If you are on Windows and you want to install a *legitimate* Python package (like for example [PyCryptodome](https://pypi.python.org/pypi/pycryptodome), because naturally you are **fully aware** that [PyCrypto is dead](https://github.com/dlitz/pycrypto/issues/173).), which in reality is a bottomless pit, at the center of which there is a C library, straight from hell - then maybe get the [Microsoft Compiler for Python](http://www.microsoft.com/en-us/download/details.aspx?id=44266) instead of, who knows, wasting hours or even days looking for a less reasonable solution. Credit, as so very often, [goes to stackoverflow](https://stackoverflow.com/a/27327236/1578458).
Github has a history of not giving a frack what their users want12. For example, a few developer friends of mine were reluctant to click any links in their notifications-page, since after they clicked the link, the notification was marked as read and you might lose track of it, if you just close the browser tab3. So David Badura4 and I decided to fix this problem by writing a browser extension. The result can be found on Github: https://github.com/larsborn/GithubToDos. After installation (also possible in Opera btw, the best browser there is), the extension injects an "Add ToDo" button on every issue page and pull request. When clicking, it, the URL gets saved to the local storage of the browser5. The list of all URLs added like this can then be access through a new button in the header toolbar of github. You can clone the project from github and add it as an "Unpacked extension" or just head to the Github ToDos on the Chrome Store and just install it from there. Pull requests are welcome, open an issue, if you find a bug, open source yadayada.
- https://github.com/dear-github/dear-github [↩]
- https://github.com/isaacs/github/issues [↩]
- on a side note, tellmewhenitcloses.com is pretty handy to avoid too many notifications in the first place [↩]
- https://github.com/DavidBadura [↩]
- Using local storage is handy for people that are not very concerned about privacy and just use the cloud synchronization feature of their browser: the content of their ToDo list will then also just be synced to all their devices. [↩]
Obviously, my Bank does not provide a REST API to download the transactions happening on my accounts. After I asked for "machine parseable" data, they told me that I can download CSV files. Awesome! So I wrote a parser and lived happily ever after. Except that they change their CSV format without notice every few months and at some point they started to mix different encodings in the same file. So I lived unhapply, regularly fixing the script reading the CSV file. What did not change for around 10 years now are their banking statements. And this also holds for the PDFs you have to download, if you want to avoid getting them via snail mail (and paying for the postage of course). I decided to parse the PDFs instead and this went pretty well for may years... up to recently, when something changed (it may have been a software update of the parser I use or something on their side). Do you want to know more?
I have started to [learn](http://rustbyexample.com/) [rust](http://rust-lang.org), and I am enjoying myself. This is a merge and update on the two fantastic blog posts on [how to setup Visual Studio Code for Rust](https://mobiarch.wordpress.com/2015/06/16/rust-using-visual-studio-code/) and [how to enable debugging](https://sherryummen.in/2016/09/02/debugging-rust-on-windows-using-visual-studio-code/). In my personal opinion, from among [all the available IDE solutions for rust](https://areweideyet.com/), this is the best. Do you want to know more?
So unless you know and use [git annex](https://git-annex.branchable.com/), this is not going to be very useful for you. Check it out, though. It's pretty cool. Unless you are on Windows. In that case it's hell. Anyway, I wrote a script to help me figure out the output of [git annex unused](http://manpages.ubuntu.com/manpages/wily/man1/git-annex-unused.1.html). In short, it tells you what those files used to be called before you lost them. Script:
You can either call it with one argument which should be a key, or if you call it with no argument, it expects you to paste the list of results you got from
#!/usr/local/bin/python3.5 import re, sys, os from subprocess import Popen,PIPE FNULL = open(os.devnull, 'w') def seeker(s): process = Popen(["git", "log", "--stat", "-S", s], stderr=FNULL, stdout=PIPE) log = process.stdout.read().decode("utf-8") match = re.search(r"(([ -~]*\/)*[ -~]*)\|", log) if not match: return '' else: return match.group(1).strip() if len(sys.argv)>1: print( seeker(sys.argv) ) else: clist =  while True: crawl = input().strip() if not crawl: break crawl = crawl.split() clist.append(crawl) for x in clist: print('%s : %s' % ( x, seeker(x) ) )
git annex unusedinto stdin. It then goes through the list and tells you the corresponding filename for each key. This script is phenomenally stupid in that it does quite a terrible regular expression search on the output of git log and returns the first match it finds. Sue me, it works pretty well at my end.
My good friend and colleague Christian Ikenmeyer and I wrote this cute preprint about polynomials and how they can be written as the determinant of a matrix with entries equal to zero, one and indeterminantes. Go ahead and read it if you know even just a little math, it's quite straightforward. The algorithm described in section 3 has been implemented and you can download the code from my website at the TU Berlin. Compilation instructions are in
ptest.c, but you will need to get nauty to perform the entire computerized proof.