Skip to content

Instantly share code, notes, and snippets.

View jcausey-astate's full-sized avatar

Jason L Causey jcausey-astate

  • Arkansas State University
  • Jonesboro, AR
View GitHub Profile
@jcausey-astate
jcausey-astate / _exam-template.md
Created July 2, 2015 13:41
Markdown Exam Templates: Write quizzes and exams in Markdown!
TODO: TITLE HERE
Name:
Read questions carefully and answer all parts as completely as possible. Vague, off-subject, or illegible answers will not earn credit.

  1. TODO: Question 1
@jcausey-astate
jcausey-astate / easy_rand.h
Last active September 29, 2015 18:21
A simple function to generate random integers in a specified range using modern C++ random functions. Inspired by Stephan T. Lavavej's 2013 talk: https://channel9.msdn.com/Events/GoingNative/2013/rand-Considered-Harmful
/**
* @file easy_rand.h
*
* Makes it easy to generate good pseudo-random values in a
* given numerical range using the new C++11 <random> features,
* without the setup overhead.
*/
#ifndef EASY_RAND_H
#define EASY_RAND_H
@jcausey-astate
jcausey-astate / replace_missing_values_in_matrix.py
Last active September 26, 2016 20:15
Given a CSV or tab-delimited input file (ASCII-encoding), replace all missing values or all occurances of a specified value with a new marker. Useful for large scientific data where some values are missing (i.e. gene microarrays, etc).
#! /usr/bin/env python
###################################################################################################
# Given a CSV or tab-delimited input file (ASCII-encoding), replace all
# missing values or all occurances of a specified value with a new marker.
# Useful for large scientific data where some values are missing (i.e. gene
# microarrays, etc)
#
# The MIT License (MIT)
#
# Copyright (c) 2016 Jason L Causey, Arkansas State University

Keybase proof

I hereby claim:

  • I am jcausey-astate on github.
  • I am jcausey_astate (https://keybase.io/jcausey_astate) on keybase.
  • I have a public key ASA4rcY4g2eyBqkPVFpLAKkmMKe8a26ZQwt_EJmB0qZMZgo

To claim this, I am signing this object:

@jcausey-astate
jcausey-astate / git-filter-to-current-tree.sh
Created May 26, 2017 22:33
Modify Git repo history so that any files/folders not present in the current worktree when the script is run will be retoactively erased from history.
#!/usr/bin/env bash
####################################################################
# Removes any files that are not currently in the working tree from
# the git repository history.
####################################################################
KEEPFILES=$(mktemp)
FULLLIST=$(mktemp)
REMOVEFILES=$(mktemp)
@jcausey-astate
jcausey-astate / run_after_proc_exit.sh
Last active March 17, 2018 16:58
Watches a running process, executing a specified command when it finishes (Bash).
#!/bin/bash
script="$(basename ${0})"
read -r -d '' USAGE <<-EOF
Watches a specified process (by pid or name) and runs
a specified command after it exits.
If watching by name, the command executes when no process
by that name is running.
Usage:
/**
* EXAMPLE FROM: https://iamtrask.github.io/2015/07/12/basic-python-network/
* I'm replicating the "3 Layer Neural Network" code using C++ and Eigen below.
* This network is trying to learn to recognize an XOR in the first two elements
* of a 3-value vector, the third value doesn't matter.
*/
#include <iostream>
#include <fstream>
#include <ctime>

Data Analysis Tools You (may) Already Have

This example will use the text of Grimms' Fairy Tales available from Project Gutenberg.

grep - Search in text!

The grep tool is installed by default on most Linux and UNIX-like systems.

Documentation is available at:

@jcausey-astate
jcausey-astate / neural_network_example.ipynb
Created October 20, 2018 18:20
An example one- and two-layer neural network from scratch in Python, with helpful references and example links.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
"""
Encodes SNP format (TSV) into a numeric matrix (CSV) format.
See docstring in `main()` for more info, or run with --help.
"""
import click
import sys, os, csv, json
@click.command()
@click.argument("input_file", type=click.File("r"))