The Rust Programming Language

The Rust Programming Language Rust is a compiled programming language which aims to replace C++. The designers wanted it to be similar fast, give the programmer similar fine-grained control over memory management, but more safety. Rust does so by introducing the concept of ownership and borrowing of variables. Rust also makes sure that after the scope is finished, the memory of variables gets de-allocated. I think FFI is interesting. It allows Rust to "talk" with C code. You should...

Dreamspark SDM Odysee

Dreamspark SDM Odysee I need to have Windows for work. As a student I should have free access to it. But when I try to download it, I have to use Microsofts "Secure Download Manager" (SDM). As a Ubuntu (Linux) user, this is easier said than done. TL;DR You need a Windows PC to download Windows. Ask a friend to download it. That might be the easiest way. If you have a Windows PC and get the same...

HTTPie

HTTPie Johannes recently showed me httpie. It's a very nice tool for sending HTTP requests. It is much simpler to use than curl. Installation $ sudo -H pip install httpie Usage $ http --form POST localhost:5000/api/recording recording=[{}] id=1 HTTP/1.0 200 OK Content-Length: 21 Content-Type: text/html; charset=utf-8 Date: Sun, 22 Mar 2015 15:50:27 GMT Server: Werkzeug/0.10.1 Python/2.7.8 edit recording with 1 The output is colored in a very nice way: HTTPie in action See also github.com/jakubroztocil/httpie requestb.in...

Python and Encodings

Python and Encodings Working with encodings different from ASCII or UTF-8 has always been work which I don't like. It doesn't feel very constructive to just make Python read a file / print some output. In the following, I will describe some strategies which might help you. Test script Copy the following text to a text file test.txt: Die süße, kleine, lärmende Überfliegerin lebt in der Haute-Côte-Nord. Dort hat es momemtan 32°C. On Debian based systems you will...

Reading and Writing Files with Python

Reading and Writing Files with Python Reading (and writing) files with Python is very easy. Here are some minimalistic code examples for beginners. Reading A very common way to handle the contents of a file is by reading the file completely and then working with a single big string. The only reason not to do so is because your file is too big. For your information, this is how long reading a file takes (all times are in seconds, reading is...

Python and CSV

Python and CSV Python has a very nice module called csv which makes working with CSV very easy. This mini article is only a reminder for me so that I can easily find how to use it when I forget once again how it is used exactly. Reading CSV files try: from future.builtins import open except: pass import csv with open('eggs.csv', 'rt', newline='') as csvfile: csvreader = csv.reader(csvfile, delimiter=';', quotechar='"') next(csvreader, None) # skip the headers for row...

Python Shell autocomplete

Python Shell autocomplete One feature I really miss in Pythons interactive shell is tab autocompletion. Thanks to blog.e-shell.org I know how to get it: >>> import rlcompleter, readline >>> readline.parse_and_bind('tab:complete') >>> smtplib. smtplib.CRLF smtplib.__getattribute__( smtplib.LMTP smtplib.__hash__( smtplib.LMTP_PORT smtplib.__init__( smtplib.OLDSTYLE_AUTH smtplib.__name__ smtplib.SMTP smtplib.__new__( smtplib.SMTPAuthenticationError( smtplib.__package__ smtplib.SMTPConnectError( smtplib.__reduce__( smtplib.SMTPDataError( smtplib.__reduce_ex__( smtplib.SMTPException( smtplib.__repr__( smtplib.SMTPHeloError( smtplib.__setattr__( smtplib.SMTPRecipientsRefused( smtplib.__sizeof__( smtplib.SMTPResponseException( smtplib.__str__( smtplib.SMTPSenderRefused( smtplib.__subclasshook__( smtplib.SMTPServerDisconnected( smtplib._addr_only( smtplib.SMTP_PORT smtplib._have_ssl smtplib.SMTP_SSL smtplib.base64 smtplib.SMTP_SSL_PORT smtplib.email smtplib.SSLFakeFile smtplib.encode_base64( smtplib.__all__ smtplib.hmac smtplib.__class__( smtplib.quoteaddr( smtplib.__delattr__( smtplib.quotedata( smtplib.__dict__ smtplib.re smtplib.__doc__ smtplib.socket...