Skip to content

Instantly share code, notes, and snippets.

View mooreryan's full-sized avatar

Ryan Moore mooreryan

View GitHub Profile
@bsmith89
bsmith89 / Makefile
Created February 5, 2016 19:21
Minorly redacted Makefile for a project using mothur to analyze 16S data.
# ====================
# Project Makefile
# ====================
# User Configuration {{{1
# ====================
# Major targets {{{2
.PHONY: figs res
figs:
# [Partially redacted]
@radaniba
radaniba / parsegb.rb
Created November 29, 2012 16:56
Parse Genbank with BioRuby
#You can parse Genbank bank files with BioRuby the standard way, but there's a hidden problem. If the file ends with blank lines, i.e. after the genbank terminator (two forwards slashes, //) there are empty lines, BioRuby reads these as additional, empty records. However, you can route around this by trimming the blank lines before handing it to the parser.
puts "Parsing seqs ..."
Bio::FlatFile.auto("foo.genbank").each_entry { |gb|
puts "Sequence '#{gb.to_biosequence.entry_id}'"
}
puts "Finished."
which will print the id of every sequence in the file. However, if the file ends with blank lines, i.e. after the genbank terminator (two forwards slashes, which the wiki markup doesn't like) there are empty lines, BioRuby reads these as additional, empty records:
@markheckmann
markheckmann / hcl_color_wheels
Last active March 1, 2018 21:16
Color wheels using colorspace::hcl by luminance
library(colorspace)
polar2cart <- function(r, theta) # polar to cartesian coords
{
rad <- theta * pi /180
cbind(x = r*cos(rad),
y = r*sin(rad))
}
h <- seq(0, 360, len=150) # hue values
#include "stdio.h"
#include "stdlib.h"
#include "emmintrin.h"
#include "time.h"
float ssesum_aligned(float* a, size_t n, double* time) {
int i;
float* p;
float result;
__m128 v1, v2;
@CarlSmotricz
CarlSmotricz / nanocad.clj
Created July 22, 2015 00:51
A tiny CAD-like program in Clojure. Uses SeeSaw for the GUI.
; a tiny, simple CAD program prototype in Clojure.
; Carl Smotricz, 2015-07-22
(ns nanocad.core
(:use [seesaw core graphics])
(:require [seesaw.mouse :refer [location]])
(:import [javax.swing AbstractAction]))
(def CANVAS-WIDTH 400)
@alimuldal
alimuldal / test_numpy.py
Last active April 5, 2020 10:25
test script for numpy BLAS linkage
#!/usr/bin/env python
import numpy
from numpy.distutils.system_info import get_info
import sys
import timeit
print("version: %s" % numpy.__version__)
print("maxint: %i\n" % sys.maxsize)
info = get_info('blas_opt')
@depp
depp / info.txt
Created April 30, 2015 20:56
Race condition example
This is what happens when I run the program. Note that 2 and 4 appear twice, but 0 and 1 never appear. The output is non-deterministic, because there is a race condition, the output could be almost anything.
Arg = 2
Arg = 4
Arg = 3
Arg = 5
Arg = 6
Arg = 2
Arg = 7
Arg = 8
Notice how each number appears only once.
The order is still scrambled, but we don't care about the order.
Arg = 1
Arg = 4
Arg = 2
Arg = 6
Arg = 3
Arg = 7
@jmackie
jmackie / README.md
Last active August 30, 2021 14:29
Basic example of file upload with progress in PureScript

Build the purescript bundle:

spago init
spago install aff console effect web-file web-xhr
spago build && spago bundle-module -m Upload -t index.cjs && browserify index.cjs -s Upload -o index.js

Spin up a dumb server to accept the POST request

@jbub
jbub / squash-commits.sh
Created June 12, 2013 15:31
git squash last two commits into one
git rebase --interactive HEAD~2
# we are going to squash c into b
pick b76d157 b
pick a931ac7 c
# squash c into b
pick b76d157 b
s a931ac7 c