Skip to content

Instantly share code, notes, and snippets.

View danielecook's full-sized avatar
😀
Things are going good

Daniel E Cook danielecook

😀
Things are going good
View GitHub Profile
@itdaniher
itdaniher / rle.py
Last active October 23, 2021 11:26
Run Length Encoding, Two Ways
import numpy as np
import itertools
def rle(x):
where = np.flatnonzero
x = np.asarray(x)
n = len(x)
if n == 0:
return np.array([], dtype=int)
starts = np.r_[0, where(~np.isclose(x[1:], x[:-1], equal_nan=True)) + 1]
@danielecook
danielecook / setup.sh
Last active April 12, 2019 08:31
Setup mac to be more like linux
# https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/
brew install coreutils
brew install binutils
brew install diffutils
brew install ed --with-default-names
brew install findutils --with-default-names
brew install gawk
brew install gnu-indent --with-default-names
brew install gnu-sed --with-default-names
@aklap
aklap / fix-missing-libcrypto-osx.md
Created October 17, 2016 04:25
Resolving missing link to libcrypto/openssl on OSX
@danielecook
danielecook / terminal_genes.sh
Created May 24, 2015 02:27
Fetch terminal genes C. elegans
end_dist=30000
chrom_I=15072434
chrom_II=15279421
chrom_III=13783801
chrom_IV=17493829
chrom_V=20924180
chrom_X=17718942
@danielecook
danielecook / plot_runkeeper.R
Last active January 16, 2017 17:47
This R Script will plot all of your runkeeper data. It uses cluster analysis to group activities by location as needed, and outputs a graph for each location. For example - I have run in Iowa City, Boston, and Chicago - and this script is able to identify those locations and output separately.
# Special thanks for insights from flowingdata.com regarding this.
library(plotKML)
library(plyr)
library(dplyr)
library(fpc)
num_locations <- 5
# Usage: Place this script in the directory containing your runkeeper data. You can run from terminal using 'Rscript map_runkeeper.R', or
@davfre
davfre / bamfilter_oneliners.md
Last active January 18, 2025 22:47
SAM and BAM filtering oneliners
@stephenturner
stephenturner / .Rprofile.r
Last active January 3, 2025 12:36
My .Rprofile
## See http://gettinggeneticsdone.blogspot.com/2013/06/customize-rprofile.html
## Load packages
library(BiocInstaller)
## Don't show those silly significanct stars
options(show.signif.stars=FALSE)
## Do you want to automatically convert strings to factor variables in a data.frame?
## WARNING!!! This makes your code less portable/reproducible.
@jrsmith3
jrsmith3 / doi2bib.py
Last active May 17, 2024 17:43
Python method to access crossref.org DOI bibtex metadata resolver
import requests
def doi2bib(doi):
"""
Return a bibTeX string of metadata for a given DOI.
"""
url = "http://dx.doi.org/" + doi
headers = {"accept": "application/x-bibtex"}
@avrilcoghlan
avrilcoghlan / find_closest_worm_paralogs4.pl
Created March 1, 2013 13:52
Perl script that, given a file of Caenorhabditis elegans paralog pairs, finds the bootstrap value for the clade defined by the last common ancestor of the two paralogs.
#!/usr/local/bin/perl
#
#
# Perl script find_closest_worm_paralogs4.pl
# Written by Avril Coghlan ([email protected])
# 16-Feb-09.
#
# This perl script finds the bootstrap value for the
# clade containing a pair of C. elegans paralogs in a family (where
# there is no other gene in that clade, ie. they are each other's
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active June 27, 2025 20:44
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application: