Skip to content

Instantly share code, notes, and snippets.

@RaphaelMeudec
RaphaelMeudec / occlusion_sensitivity.py
Created July 18, 2019 08:55
Perform occlusion sensitivity with Tensorflow 2.0
import numpy as np
import tensorflow as tf
# Create function to apply a grey patch on an image
def apply_grey_patch(image, top_left_x, top_left_y, patch_size):
patched_image = np.array(image, copy=True)
patched_image[top_left_y:top_left_y + patch_size, top_left_x:top_left_x + patch_size, :] = 127.5
return patched_image
@nornagon
nornagon / smith_waterman.py
Created July 21, 2017 04:07
Smith-Waterman Python implementation
import numpy as np
def smith_waterman(a: str, b: str, alignment_score: float = 1, gap_cost: float = 1) -> float:
"""
Compute the Smith-Waterman alignment score for two strings.
See https://en.wikipedia.org/wiki/Smith%E2%80%93Waterman_algorithm#Algorithm
This implementation has a fixed gap cost (i.e. extending a gap is considered
free). In the terminology of the Wikipedia description, W_k = {c, c, c, ...}.
This implementation also has a fixed alignment score, awarded if the relevant

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: