Skip to content

Instantly share code, notes, and snippets.

@WillForan
WillForan / test.asciidoc
Created April 24, 2012 14:51
asciidoc test

Header

bold code

blah

\(C = \alpha + \beta Y^{\gamma} + \epsilon\)

\$`x/x={(1,if x!=0),(text{undefined},if x=0):}`\$

@WillForan
WillForan / home bin spacemacs
Created April 29, 2015 17:45
easily "install" and run spacemacs
#!/usr/bin/env bash
# download and modify spacemacs
# s.t. we do not have to overwrite our current emacs configuration
# ideally:
# 0. export PATH="$PATH:$HOME/bin"
# 1. put this script in $HOME/bin/spacemacs
# 2. use "spacemacs" to run spacemacs
cfgd=$HOME/.spacemacs.d/
library(ggplot2)
library(dplyr)
library(tidyr)
##DATA
WM <- structure(list(ID = structure(1:32, .Label = c("10843_20151015",
"11228_20150309", "11339_20141104", "11340_20141031", "11341_20141118",
"11348_20141119", "11349_20141124", "11351_20141202", "11352_20141230",
"11354_20141205", "11355_20141230", "11356_20150105", "11357_20150122",
"11358_20150129", "11359_20150203", "11360_20150129", "11363_20150310",
labelHeat <- function(rsvars,dsivars,Title,tifname) {
# rsvars="Ramyg_cm2_16"
#dsivars="Ramyg_cm2_16_final_qa0"
#location of completed analyses
rootpath <- "/Users/mariaj/Dropbox/Pitt/Luna/amyg_con/01_data/Z_scores_4_Fig3"
#where I want to put my images
imgpath <- "/Users/mariaj/Dropbox/Pitt/Luna/amyg_con/01_data/Z_scores_4_Fig3"
#make plot in variable that show the age effects identified in spline analyses
library(dplyr)
#options(stringsAsFactors = F)
#z1=read.delim(file='/Users/jalbrzikowskime/gordon_ci.txt',header=F)
#z2=read.delim(file='/Users/jalbrzikowskime/infomap_luna_denoise_t9.txt',header=F)
# fake data
d<-data.frame(
id=c(1,2,3,4,5,6,7,8,9,10),
z1=c(1,1,1,3,3,3,3,2,2,1),
#!/usr/bin/env bash
# where to transfer folders
locOnGinger=/path/to/new/Siegle/
# make sure we can save logs
[ ! -d rsynclog] && mkdir rsynclog
# get dirs to tx from google doc, only grab those less than 300Gb
curl 'https://docs.google.com/spreadsheets/d/1wfXnWH7zI6H79u6o3fYV59iPBhG-JyaGhys7O9zmDCE/pub?output=tsv'|
#!/usr/bin/env R
library(curl)
library(dplyr)
library(tidyr)
library(ggplot2)
library(cowplot)
library(gridExtra)
# get data
url <- 'https://docs.google.com/spreadsheets/d/e/2PACX-1vR0TLhKqeEWZsJqbIuZ38bLc3vVeUpPx9rYnS1QG9kp4Wgv9rvCRHplf1fDy4rFbmC1CAQoVLVW3NX7/pub?output=tsv'
req <- curl_fetch_memory(url)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ######
# sample short code -- test features
# USAGE:
# pipenv run pylivetrader run -f AlpacaShortTest.py --backend-config config.yaml
# ######
import pylivetrader.backend.alpaca
[2019-03-19 18:27:45.593426] INFO: Algorithm: livetrader start running with backend = alpaca data-frequency = minute
have Portfolio({
'capital_used': 0.0,
'starting_cash': 0.0,
'portfolio_value': 22924.4,
'pnl': 0.0,
'returns': 0.0,
'cash': 87439.91,
'positions': {
Asset(03fb07bb-5db1-4077-8dea-5d711b272625, symbol=AMD, asset_name=AMD, exchange=NASDAQ): Position({
# dumpy data
MRSfake <-
data.frame(age=c(10,20,30),
roi=c('a','b','c'),
m1=c(1,2,3),
m2=c(4,5,NA))
# initial
MRS_age_effect <- function(region, metabolite) {
temp <- filter(MRS, roi == region)