This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
S. R. Cloude and E. Pottier, "An entropy based classification scheme for land applications of polarimetric SAR," in IEEE Transactions on Geoscience and Remote Sensing, vol. 35, no. 1, pp. 68-78, Jan. 1997, doi: 10.1109/36.551935. | |
""" | |
import matplotlib.pyplot as plt | |
import numpy as np | |
def h_alpha_decomposition(T3): | |
assert isinstance(T3, np.ndarray) | |
assert T3.ndim >= 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function __curl() { | |
read proto server path <<<$(echo ${1//// }) | |
DOC=/${path// //} | |
HOST=${server//:*/} | |
PORT=${server//*:/} | |
[[ x"${HOST}" == x"${PORT}" ]] && PORT=80 | |
exec 3<>/dev/tcp/${HOST}/$PORT | |
echo -en "GET ${DOC} HTTP/1.0\r\nHost: ${HOST}\r\n\r\n" >&3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "This is a console commands collection, do not run this script directly" | |
exit 1 | |
# latexdiff | |
latexdiff "$1" "$2" >_diff.tex 2>/dev/null | |
sed -i.bak '/\RequirePackage\[normalem\]{ulem}/d' _diff.tex | |
xelatex _diff | |
bibtex _diff | |
xelatex _diff |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Configuration file for jupyter-notebook. | |
#------------------------------------------------------------------------------ | |
# Application(SingletonConfigurable) configuration | |
#------------------------------------------------------------------------------ | |
## This is an application. | |
## The date format used by logging formatters for %(asctime)s | |
# Default: '%Y-%m-%d %H:%M:%S' | |
# c.Application.log_datefmt = '%Y-%m-%d %H:%M:%S' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pandoc part-1.md[, part-2.md, ...] -o book.md | |
pandoc --metadata title="<book-name>" book.md -o book.epub |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
def relative_history_date(history_datetime): | |
"""Format history datetime to relative representation. | |
Parameters | |
---------- | |
history_datetime : datetime |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import wraps | |
def show_func_repr(func): | |
@wraps(func) | |
def wrapper(*args, **kwargs): | |
print('{func}({args}{kwargs})'.format( | |
func=func.__name__, | |
args=', '.join([f'{arg!r}' for arg in args]), | |
kwargs=''.join([f', {k}={v!r}' for k, v in kwargs.items()]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Wrap up the [subl] command with the ability that auto-activate the .sublime-project setting file under project directory. | |
# | |
# relative issue / solution | |
# ------------------------- | |
# 1. https://stackoverflow.com/questions/14203944/sublime-text-folder-exclude-patterns-stopped-working | |
# 2. https://forum.sublimetext.com/t/project-settings-when-opened-with-subl/11419 | |
# 3. https://gist.github.com/imjared/7010577 | |
function subl() { | |
sublime_project_file="${1##*/}.sublime-project" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rename conda env and redirect bash shebang to new env. | |
# | |
# Reference | |
# --------- | |
# https://stackoverflow.com/a/62853056/11533669 | |
# rename | |
# The two variables below should be something like path str or filename if the file presents in current directory | |
mv $OLD_ENV_NAME $NEW_ENV_NAME |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
"""Combine multiple screenshots with the same shape. | |
Usage | |
----- | |
1. Specify a list of screenshots. | |
stitch-videoshots screenshot1 screenshot2 screenshot3 | |
2. Specify a dictionary contains screenshots. | |
stitch-videoshots -d ./mypath [--sort] |
NewerOlder