Skip to content

Instantly share code, notes, and snippets.

@ehiggs
ehiggs / csv.pest
Created January 22, 2018 07:57
pest csv reader example attempt
record = @{ field ~ ("," ~ field)* }
field = @{ "\"" ~ (!("\"" | "\\") ~ any)* ~ "\"" | (!( "," | "\n"))* }
@ehiggs
ehiggs / benchstringbuilder.rs
Created January 27, 2017 13:31
Rust StringBuilder
#![feature(test)]
extern crate test;
use test::Bencher;
const LORUM: &'static str = r#"Lorem ipsum dolor sit amet, consectetur adipiscing
elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur
sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est
easyblock = 'CMakeMake'
name = 'Salmon'
version = '0.4.2'
homepage = 'https://github.com/COMBINE-lab/salmon'
description = """Salmon is a wicked-fast program to produce a highly-accurate,
transcript-level quantification estimates from RNA-seq data.
"""
@ehiggs
ehiggs / .conkryrc
Created December 12, 2011 15:05
My conkyrc file. Screenshot available at: http://i.imgur.com/tBGbe.jpg
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
# fiddle with window
@ehiggs
ehiggs / commit.c
Created May 3, 2010 15:19
Git message editing.
static int prepare_to_commit(const char *index_file, const char *prefix,
struct wt_status *s)
{
struct stat statbuf;
int commitable, saved_color_setting;
struct strbuf sb = STRBUF_INIT;
char *buffer;
FILE *fp;
const char *hook_arg1 = NULL;
const char *hook_arg2 = NULL;
@ehiggs
ehiggs / msgeditor.py
Created May 3, 2010 14:49
Bazaar message editing.
def _get_editor():
"""Return a sequence of possible editor binaries for the current platform"""
try:
yield os.environ["BZR_EDITOR"], '$BZR_EDITOR'
except KeyError:
pass
e = config.GlobalConfig().get_editor()
if e is not None:
yield e, config.config_filename()
@ehiggs
ehiggs / util.py
Created May 3, 2010 14:24
Mercurial message editing.
#file: util.py
def system(cmd, environ={}, cwd=None, onerr=None, errprefix=None):
'''enhanced shell command execution.
run with environment maybe modified, maybe in different dir.
if command fails and onerr is None, return status. if ui object,
print error message and return status, else raise onerr object as
exception.'''
def py2shell(val):
'convert python object into string that is useful to shell'