Skip to content

Instantly share code, notes, and snippets.

@jfear
jfear / keybindings.json
Created May 10, 2023 01:32 — forked from kevinslin/keybindings.json
Kevin's VSCode Keybindings
// Place your key bindings in this file to override the defaults
[
// The following are Kevin's keybindings for VSCode
// They are made available under CC BY 4.0
//
// To navigate
// `==` denote sections
// `---` denotes subsections
//
// == Dendron
@jfear
jfear / loopy.bash
Last active March 17, 2023 00:12
Example using loops and regular expressions
#!/bin/bash
# I personally would merge sample across lane. Gzip file can just be concated
# together and as long as R1 and R2 are done in the same order it should work
# fine.
#
# going from
# - 1860_Time_0_S1_L001_R1_001.fastq.gz
# - 1860_Time_0_S1_L002_R1_001.fastq.gz
# - 1860_Time_0_S1_L002_R1_001.fastq.gz
@jfear
jfear / logging_example.py
Created September 1, 2021 13:38 — forked from mbrengel/logging_example.py
Python Logging Setup
#!/usr/bin/env python3
import logging
from logging.handlers import RotatingFileHandler
import sys
import colorama
def configure_logging():
# enable cross-platform colored output
colorama.init()
@jfear
jfear / fix-wsl2-dns-resolution
Created February 26, 2021 12:43 — forked from coltenkrauter/fix-wsl2-dns-resolution
Fix DNS resolution in WSL2
More recent resolution:
1. cd ~/../../etc (go to etc folder in WSL).
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line).
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line).
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian).
5. cd ~/../../etc (go to etc folder in WSL).
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file).
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and
secondary.
@jfear
jfear / gist:b14658b54d5309ed2343e7bc6f4c151b
Last active October 12, 2020 17:06
Flatten nested dict/lists into a single list.
def flatten_nested(content: Union[list, dict, ChainMap]) -> List[Union[str, int, float]]:
"""Flatten an arbitrary nested dictionary.
Useful for flattening file patterns from a Yaml config.
Example:
>>> content = {"one": ["one_a", "one_b"], "two": "two_a"}
>>> sorted(flatten_nested(content))
["one_a", "one_b", "two_a"]
@jfear
jfear / development_environment.sh
Last active July 7, 2020 14:00
The script I use generate my podman container development environment.
#!/bin/bash -e
toolbox rm --force fedora-toolbox-32
echo "## Creating development container..."
toolbox create
run="toolbox run"
echo "## Updating Image"
@jfear
jfear / README MongoDB Podman
Last active December 28, 2023 18:31
Setting up mongod using podman
Copyright (c) 2021 Justin M. Fear
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@jfear
jfear / jupyterlab_setup.sh
Last active February 20, 2019 15:38
My basic setup for jupyterlab.
#!/bin/bash
conda create -n jupyter jupyterlab jupytext nodejs nb_conda ipywidgets nbdime ipympl jupyterlab-git
source activate jupyter
jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install jupyterlab_vim
jupyter labextension install @jupyterlab/git
jupyter serverextension enable --py jupyterlab_git
jupyter labextension install @jupyterlab/toc
jupyter labextension install jupyterlab_bokeh
jupyter labextension install @ijmbarr/jupyterlab_spellchecker
@jfear
jfear / README-setup-tunnel-as-systemd-service.md
Created February 19, 2019 15:46 — forked from drmalex07/README-setup-tunnel-as-systemd-service.md
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward

README

Create a template service file at /etc/systemd/system/[email protected]. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target
"""Plot heatmap of all genes.
Plots the tpm normalized zscores of all genes as a heatmap.
"""
import numpy as np
import pandas as pd
from scipy.stats import fisher_exact
import matplotlib as mpl
from matplotlib.gridspec import GridSpec, GridSpecFromSubplotSpec
import matplotlib.pyplot as plt