Skip to content

Instantly share code, notes, and snippets.

View mbhall88's full-sized avatar

Michael Hall mbhall88

View GitHub Profile
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
def hex_to_rgb(value):
'''
Converts hex to rgb colours
value: string of 6 characters representing a hex colour.
Returns: list length 3 of RGB values'''
value = value.strip("#") # removes hash symbol if present
@artoby
artoby / symlog_bins.py
Last active May 30, 2022 05:08
Symlog bins - splits a data range into log-like bins but with 0 and negative values taken into account
import numpy as np
def symlog_bins(arr, n_bins, zero_eps=0.1, padding=0):
"""
Splits a data range into log-like bins but with 0 and negative values taken into account.
Can be used together with matplotlib 'symlog' axis sacale (i.e. ax.set_xscale('symlog'))
Feel free to contribute: https://gist.github.com/artoby/0bcf790cfebed5805fbbb6a9853fe5d5
"""
a = min(arr) / (1 + padding)
b = max(arr) * (1 + padding)
@juanfal
juanfal / gist:09d7fb53bd367742127e17284b9c47bf
Created January 10, 2020 09:07
Codon table in Python dict
codontab = {
'TCA': 'S', # Serina
'TCC': 'S', # Serina
'TCG': 'S', # Serina
'TCT': 'S', # Serina
'TTC': 'F', # Fenilalanina
'TTT': 'F', # Fenilalanina
'TTA': 'L', # Leucina
'TTG': 'L', # Leucina
'TAC': 'Y', # Tirosina
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lukechilds
lukechilds / get_latest_release.sh
Created August 9, 2016 19:43
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active April 16, 2024 16:36
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository