Skip to content

Instantly share code, notes, and snippets.

@spacedman
spacedman / resizeRpanel.R
Created July 6, 2012 22:27
Resizing rpanel widgets
# here is a way to make an rpanel dialog wider. Useful when the default skinny
# sliders are not precise enough for fat fingered prodders:
# standard slider demo
density.draw <- function(panel) {
plot(density(panel$x, bw = panel$h))
panel
}
# create panel and add slider. Note aschar=FALSE so we can get the $window:
@spacedman
spacedman / readNotes.py
Created August 27, 2012 07:18
Extract the text of notes from an OpenOffice presentation
#!/usr/bin/python
from lxml import etree
import zipfile
# some namespaces we may need
DRAW="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
DRAWC = "{%s}" % DRAW
PRES='urn:oasis:names:tc:opendocument:xmlns:presentation:1.0'
PRESC = "{%s}" % PRES
@spacedman
spacedman / unsass.R
Created January 15, 2013 23:40
Unstructuring assignments in R...
###
### unsass.R
###
### a fairly syntactically clean way of doing unstructuring assignments in R
###
### syntax: (a~b~c) %=% list(A,B,C)
###
### not very tested
###
unsass <- function(lhs,rhs){
\documentclass{beamer}
\begin{document}
<<echo=FALSE>>=
library("qgraph")
@
%%% SLIDE 1 %%%
\begin{frame}[fragile]{Weights matrices}
\begin{columns}
\documentclass{article}
\title{Warren Buffet's 1B Basketball Challenge}
\begin{document}
\maketitle
\section{Expected Value}
@spacedman
spacedman / setdpi.sh
Created April 21, 2014 19:00
Tweak the DPI on an image file so that it specifies it to be a certain number of inches.
#!/bin/sh
#
# take an image and a desired width in inches, set the DPI
#
input=$1
width=$2
echo $input
echo $width