Skip to content

Instantly share code, notes, and snippets.

View Freed-Wu's full-sized avatar
🙃
busy

wzy Freed-Wu

🙃
busy
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 November 2, 2024 05:33
mailcap file to display files in and outside of terminal for mutt, less, ranger / lf, ..
# 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 $HOME/.mailcap`
# - in Vim by adding to your vimrc
#
@fnky
fnky / ANSI.md
Last active April 27, 2025 09:00
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@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
#!/usr/bin/perl -w
# 作者: 洪朝貴 http://www.cyut.edu.tw/~ckhung/, 2001.
# 趙惟倫 <[email protected]>, 2012.
# 功能: 讓使用者下象棋的程式. 純粹只是版面安排及棋子移動;
# 沒有電腦下棋的功能.
# 需求: 系統內應有 ncurses 程式庫, 及 perl 的 curses 模組.
# 操作說明: 用方向鍵移動遊標, 用空間棒撿起/放下棋子,
# 按 s 將目前盤面存檔. 所存檔案, 下次可作為命令列參數
# 其他: 在彩色終端機上可顯示彩色 (例如 cxterm-color 或 linux
# console); 在黑白終端機上 (例如 MS Windows 的 telnet)
@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