Skip to content

Instantly share code, notes, and snippets.

View Freed-Wu's full-sized avatar
🤮
hurt

wzy Freed-Wu

🤮
hurt
View GitHub Profile
@MaxXSoft
MaxXSoft / Dockerfile
Created November 27, 2022 09:40
A fun tool for generating an x86-64 Linux program that runs in reverse order.
FROM ubuntu:20.04
RUN apt update && DEBIAN_FRONTEND="noninteractive" apt install -y \
python3 build-essential
WORKDIR /root
@Konfekt
Konfekt / mailcap
Last active September 17, 2024 08:09
mutt mailcap file to display attachments in mutt mail client
# Save as ~/.mailcap. Then use run-mailcap to:
#
# - open files by `run-mailcap --action=view <file>`, or
# - view them in the terminal by `run-mailcap --action=cat <file>`.
#
# Useful
#
# - in mutt by `set mailcap_file ~/.mailcap`
# - in less by LESSOPEN="|run-mailcap --action=cat %s", or
# - in ranger or lf by making scope.sh run
@jeremyjordan
jeremyjordan / soft_dice_loss.py
Last active September 20, 2023 12:50
Generic calculation of the soft Dice loss used as the objective function in image segmentation tasks.
def soft_dice_loss(y_true, y_pred, epsilon=1e-6):
'''
Soft dice loss calculation for arbitrary batch size, number of classes, and number of spatial dimensions.
Assumes the `channels_last` format.
# Arguments
y_true: b x X x Y( x Z...) x c One hot encoding of ground truth
y_pred: b x X x Y( x Z...) x c Network output, must sum to 1 over c channel (such as after softmax)
epsilon: Used for numerical stability to avoid divide by zero errors
@iwanbk
iwanbk / split_string_by_line.lua
Created April 29, 2013 03:39
Split string by line in Lua
for line in yourString:gmatch("([^\n]*)\n?") do
-- do something
end