Skip to content

Instantly share code, notes, and snippets.

View harper357's full-sized avatar

G Fedewa harper357

  • Nuanced Health
View GitHub Profile
@harper357
harper357 / markdown-mermaid-replacement.rb
Created February 5, 2020 15:44
Jekyll plugin to replace Markdown code blocks (for mermaid syntax)
# modified from https://gist.github.com/mmistakes/77c68fbb07731a456805a7b473f47841
# Description: Jekyll plugin to replace Markdown code blocks (for mermaid syntax) with <div class="mermaid"> tag for crafting mermaid charts with minimal headache
# place in /_plugins/
Jekyll::Hooks.register :posts, :pre_render do |post, payload|
docExt = post.extname.tr('.', '')
# only process if we deal with a markdown file
if payload['site']['markdown_ext'].include? docExt
newContent = post.content.gsub(/```mermaid([^`]+?)```/, '<div class="mermaid">\1</div>')
post.content = newContent

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@harper357
harper357 / markdown-img-picture-replacement.rb
Created November 28, 2018 14:30 — forked from mmistakes/markdown-img-picture-replacement.rb
Jekyll plugin to replace Markdown images eg. `![description](image.jpg)` with `{% picture %}` tag
# Description: Jekyll plugin to replace Markdown image syntax with {% picture %} tag for crafting responsive images
# place in /_plugins/
Jekyll::Hooks.register :posts, :pre_render do |post, payload|
docExt = post.extname.tr('.', '')
# only process if we deal with a markdown file
if payload['site']['markdown_ext'].include? docExt
newContent = post.content.gsub(/\!\[(.+)\]\((.+)\)/, '{% picture default \2 alt="\1" %}')
post.content = newContent
end
@harper357
harper357 / google_assistant.py
Created May 2, 2017 23:41 — forked from ganeshkamathp/google_assistant.py
macos google assistant
"""Sample that implements gRPC client for Google Assistant API."""
from google.assistant.embedded.v1alpha1 import embedded_assistant_pb2
from google.rpc import code_pb2
import logging
import os.path
from googlesamples.assistant import (
assistant_helpers,
audio_helpers,
@harper357
harper357 / tmux-cheatsheet.markdown
Created October 6, 2016 18:42 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@harper357
harper357 / ipython_notebook_in_git.md
Created July 15, 2016 21:33 — forked from pbugnion/ ipython_notebook_in_git.md
Keeping IPython notebooks under Git version control

This gist lets you keep IPython notebooks in git repositories. It tells git to ignore prompt numbers and program outputs when checking that a file has changed.

To use the script, follow the instructions given in the script's docstring.

For further details, read this blogpost.

The procedure outlined here is inspired by this answer on Stack Overflow.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@harper357
harper357 / useful_pandas_snippets.py
Last active September 11, 2015 05:41 — forked from bsweger/useful_pandas_snippets.md
Useful Pandas Snippets
#List unique values in a DataFrame column
pd.unique(df.column_name.ravel())
#Convert Series datatype to numeric, getting rid of any non-numeric values
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True)
#Grab DataFrame rows where column has certain values
valuelist = ['value1', 'value2', 'value3']
df = df[df.column.isin(value_list)]
@harper357
harper357 / VCF.py
Last active September 9, 2015 18:30 — forked from slowkow/VCF.py
VCF.py is a simple module for reading VCF files
"""
VCF.py
Kamil Slowikowski
October 30, 2013
Read VCF files. Works with gzip compressed files and pandas.
Note: This module ignores the genotype columns because
I didn't need them at the time of writing.