Skip to content

Instantly share code, notes, and snippets.

@shihrer
shihrer / error.md
Last active March 9, 2019 00:30
.NET Core Error Message

From middleware:

return httpContext.Response.WriteAsync(new ErrorDTO
{
    Message = "Some Message",
    Title = "Some Title
}).ToString();

From Controller:

@shihrer
shihrer / Packer.py
Last active October 8, 2021 17:57
Simple packing solution for Python. This is a python version of the algorithm located at http://codeincomplete.com/posts/2011/5/7/bin_packing/
"""
MIT License
Copyright (c) 2016 Michael Shihrer (michael@shihrer.me)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is