Skip to content

Instantly share code, notes, and snippets.

Avatar
🔋
Full of energy!

Mikolaj Buchwald mikbuch

🔋
Full of energy!
View GitHub Profile
@shaypal5
shaypal5 / confusion_matrix_pretty_print.py
Last active Apr 27, 2022
Pretty print a confusion matrix with seaborn
View confusion_matrix_pretty_print.py
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
FauxFaux / do-release-upgrade.md
Last active Jun 15, 2022
What does Ubuntu's do-release-upgrade script actually do?
View do-release-upgrade.md

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
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
jimjam88 / print-resultset.java
Last active Feb 16, 2019
Print an ResultSet to the console (STDOUT)
View print-resultset.java
// 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
bradmontgomery / dummy-web-server.py
Last active Jul 21, 2022
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
View dummy-web-server.py
#!/usr/bin/env python
"""
Very simple HTTP server in python (Updated for Python 3.7)
Usage:
./dummy-web-server.py -h
./dummy-web-server.py -l localhost -p 8000
Send a GET request: