Skip to content

Instantly share code, notes, and snippets.

Full of energy!

Mikolaj Buchwald mikbuch

Full of energy!
View GitHub Profile
shaypal5 /
Last active Apr 27, 2022
Pretty print a confusion matrix with seaborn
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
def print_confusion_matrix(confusion_matrix, class_names, figsize = (10,7), fontsize=14):
"""Prints a confusion matrix, as returned by sklearn.metrics.confusion_matrix, as a heatmap.
Note that due to returning the created figure object, when this funciton is called in a
notebook the figure willl be printed twice. To prevent this, either append ; to your
function call, or modify the function by commenting out the return expression.
FauxFaux /
Last active Jun 15, 2022
What does Ubuntu's do-release-upgrade script actually do?

Ubuntu encourage upgrading between releases by running a command, instead of by manually editing sources and getting on with it. This tool's name is do-release-upgrade, and I believe it should just be doing:

sed -i 's/wily/xenial/g' /etc/apt/sources.list /etc/apt/sources.list.d/*

This command does not explain what it wants to do, or why it is doing anything. It has, in the past:

  • Disabled repos I was using, and hence broken the software in them.
toast38coza / commands
Last active Mar 3, 2022
Simple systemd unit for running a django app
View commands
# start / stop / restart / status
systemctl start test
systemctl stop test
systemctl restart test
systemctl status test
# logs use journalctl:
# tail the logs for unit `django`
journalctl -f -u django
jimjam88 /
Last active Feb 16, 2019
Print an ResultSet to the console (STDOUT)
// Imports required
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
* Print a result set to system out.
* @param rs The ResultSet to print
* @throws SQLException If there is a problem reading the ResultSet
bradmontgomery /
Last active Jul 21, 2022
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
Very simple HTTP server in python (Updated for Python 3.7)
./ -h
./ -l localhost -p 8000
Send a GET request: