Skip to content

Instantly share code, notes, and snippets.

View cameronbracken's full-sized avatar

Cameron Bracken cameronbracken

View GitHub Profile
@cameronbracken
cameronbracken / diagram.mermaid
Created March 12, 2024 17:05
Gridded Solar Wind Workflow
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
cam@cam-ubuntu-home-server:~$ cat /etc/mdadm/mdadm.conf
# mdadm.conf
#
# !NB! Run update-initramfs -u after updating this file.
# !NB! This will ensure that initramfs has an uptodate copy.
#
# Please refer to mdadm.conf(5) for information about this file.
#
# by default (built-in), scan all partitions (/proc/partitions) and all
@cameronbracken
cameronbracken / Rlint.R
Created August 7, 2013 17:56
Demonstrates R lint error. Run like this (need to make executable first, `chmod +x Rlint.R`): ./Rlint.R lint_test.R
#!/usr/bin/env Rscript
try_require <- function(pkg){
e <- try(
suppressPackageStartupMessages(library(pkg,character.only=TRUE))
,silent=TRUE)
if(class(e) == 'try-error')
invisible(FALSE)
else
invisible(TRUE)
@cameronbracken
cameronbracken / R-roxygen.tmLanguage
Created August 1, 2011 21:15
TextMate syntax highlighting for R with roxygen
{ scopeName = 'source.r';
fileTypes = ( 'R', 'r', 's', 'S', 'Rprofile' );
foldingStartMarker = '^[^#]*(\([^\)]*$|\{\s*$)';
foldingStopMarker = '(^\s*\)|^\s*\})';
patterns = (
{ name = 'comment.line.number-sign.r';
match = "(#(?!').{1}).*$\n?";
captures = { 1 = { name = 'punctuation.definition.comment.r'; }; };
},
{ name = 'storage.type.r';
@cameronbracken
cameronbracken / pgfSweave-concordance.Rnw
Created June 20, 2011 18:10
pgfSweave example file for concordance
\documentclass{article}
\usepackage{Sweave}
\usepackage{tikz}
\SweaveOpts{keep.source=TRUE,tidy=TRUE,concordance=TRUE}
\begin{document}
<<>>=
# Small function with highlight=TRUE and tidy=TRUE and some additional garbage.......
@cameronbracken
cameronbracken / pgfSweave-example-LARGE.Rnw
Created May 4, 2011 22:28
Example increasing the font size of highlighted output
\documentclass{article}
\usepackage{tikz}
\usepackage[margin=1in]{geometry}
\title{Minimal pgfSweave Example}
\author{Cameron Bracken}
\renewenvironment{Hinput}{\begin{trivlist}\item\LARGE}{\end{trivlist}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% This Beamer template was created by Cameron Bracken.
%%
%% Last Modified: April 9, 2011
%%
%% This work is licensed under a Creative Commons Attribution 3.0
%% Unported License (http://creativecommons.org/licenses/by/3.0/).
%%
%% Any versions last modified before April 9, 2011 carried this notice:
@cameronbracken
cameronbracken / break.comments.R
Created January 10, 2011 07:49
Break up long comments to multiple lines
# Do not need to load this library but need it installed
# library(tm)
library(stringr)
# get dummy text
loremipsum <- system.file("texts", "loremipsum.txt", package = "tm")
#A really long single line comment
comment <- paste('#', paste(readLines(loremipsum),collapse=''))
SRC=myRunifConcise.c randFortran.f90 randWrapper.c
all:
R CMD COMPILE FCFLAGS='-O2' $(SRC)
R CMD SHLIB $(SRC) -o myRand.so
clean:
rm *.o *.so
set.seed(101)
x <- c(rnorm(5000),rnorm(5000,4,1.5))
y <- c(rnorm(5000),rnorm(5000,2,3))
hb2 <- hexbin(x,y)
cr <- colorRampPalette(c('gray','blue'))
plot(hb2,colramp=cr,border=gray(.75))
# Or no border, can't decide
# plot(hb2,colramp=cr)