Skip to content

Instantly share code, notes, and snippets.

@josephwb
josephwb / getlineSafe
Created June 4, 2014 15:53
C++ getline for when line endings are unknown
// g++ -Wall getlineSafe.cpp -o getlineSafe -O
#include <string.h>
#include <iostream>
#include <fstream>
#include <cstdlib>
std::istream& getlineSafe(std::istream& is, std::string& t) {
t.clear();
@josephwb
josephwb / cmpFiles.sh
Created March 6, 2014 16:52
Compare 2 files, byte-by-byte
#!/bin/bash
## script to check if files contain identical data (by byte). stops at first difference.
## Usage:
## ./cFiles.sh file1 file2
## It may be necessary to change access permission to make the script executable. Type:
## chmod 755 cFiles.sh
if [ "$#" -ne 2 ]
then
@josephwb
josephwb / getNexson.sh
Last active December 30, 2015 04:18
Get nexson(s) study files from Phylografter.
#!/bin/bash
## script to grab individual nexson(s) from Phylografter
## Usage:
## ./getNexson.sh study1ID study2ID ...
## where study*ID is the Phylografter study identifier. For example, to get studies 420 and 1428, type:
## ./getNexson.sh 1428 420
## It may be necessary to change access permission to make the script executable. Type:
## chmod 755 getNexson.sh