Skip to content

Instantly share code, notes, and snippets.

View larsvilhuber's full-sized avatar

Lars Vilhuber larsvilhuber

View GitHub Profile
base <- "/rdcprojects/tr/tr00612"
version <- "2.0.2" # specify the version of the dataset
myid <- "specXXX"
prefix <- "synlbd"
# load packages - also see code snippet below for repos setup
library(foreign)
inputs = paste(base,"/data/synlbd/",version,sep="")
mydata = paste(base,"/programs/users/",myid,"/data",sep="")
analysis_file ...
save(analysis_file,file=paste(mydata,"/analysis_file.RData",sep=""))
@larsvilhuber
larsvilhuber / sds_initialize.R
Last active August 24, 2017 23:16
Work with CRAN mirror on SDS
CRAN_base <- "file:/cac/contrib/mirror/CRAN/" # location of the local CRAN mirror - this will be different at validation!
# set CRAN base, ensuring that install.packages() can find its files
mypackages <- c("xyz","abc")
local({
r <- getOption("repos")
r["CRAN"] <- CRAN_base
options(repos = r)
})
install.packages(mypackages)
@larsvilhuber
larsvilhuber / sds_initialize.do
Last active August 10, 2017 17:55
Work with REPEC mirror on SDSx
/* set the local install versions to the project directory */
/* this will ensure that the project directory contains a local copy */
/* Ensure the directories exist! */
global PROJDIR "/projects/user/xyz/project1"
sysdir set PLUS "${PROJDIR}/stata/plus"
sysdir set PERSONAL "${PROJDIR}/stata/personal"
/* from https://www2.vrdc.cornell.edu/news/synthetic-data-server/step-4-using-the-sds/#Packages
and https://gist.github.com/larsvilhuber/002ffc7fa96136426a4801e1470e0189#file-sds_initialize-do */
@larsvilhuber
larsvilhuber / myOpenMPI.qsub
Last active September 2, 2016 20:25
myOpenMPI.qsub
#!/bin/bash -l
# Output (log) and errors will go into the system-defined stdout file
#PBS -j oe
##############################################################################
# Based on http://csc.cnsi.ucsb.edu/docs/running-jobs-torque
# IMPORTANT: the next line determines how many nodes to run on
# nodes is number of nodes, ppn= processors (cores) per node
#
#PBS -l nodes=2:ppn=32
#
@larsvilhuber
larsvilhuber / SR-test.tex
Created September 6, 2016 01:54
Code that seems to flumox StatRep package.
\begin{Sascode}[store=mytest,program]
%macro main;
data one;
do j=1 to 10;
%do i = 1 %to 70;
var&i. = &i.;
%end;
output;
end;
run;
@larsvilhuber
larsvilhuber / mirror.repec.sh
Created September 30, 2016 21:11
Mirroring of Stata packages from Repec
#!/bin/bash
SRCURL=http://fmwww.bc.edu/repec/bocode/
if [[ -z $1 ]]
then
cat << EOF
$0 start
mirror $SRCURL to this directory
@larsvilhuber
larsvilhuber / jupyter.qsub
Created November 11, 2016 22:58
Qsub file to run a jupyter notebook instance
#!/bin/bash -l
#PBS -l walltime=01:00:00
#PBS -l ncpus=1
#PBS -N jupyter
source /etc/profile.d/modules.sh
module load python/anaconda
hostname
jupyter notebook
@larsvilhuber
larsvilhuber / gist:77eba9016504bedbede51dd6683aa573
Created October 26, 2017 03:06
OJS3 import with href submission file
<?xml version="1.0"?>
<issue xmlns="http://pkp.sfu.ca" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" published="1" current="1" access_status="1" xsi:schemaLocation="http://pkp.sfu.ca native.xsd">
<id type="internal" advice="ignore">1</id>
<issue_identification>
<volume>1</volume>
<number>10</number>
<year>2009</year>
<title locale="en_US">Old Issue</title>
</issue_identification>
<date_published>2009-01-01</date_published>
@larsvilhuber
larsvilhuber / add_datatoggle.sh
Last active May 14, 2020 09:17
Add a Data Toggle Tile to Samsung devices without root
#!/bin/bash
# Based on https://www.xda-developers.com/how-to-restore-mobile-data-quick-settings-tile-toggle-on-samsung-galaxy-devices/
# This will work with minor adjustments to your installation of the Android SDK or wherever you put adb.
# Should work on Linux and Mac, but only tested on Linux
PATH=../android-sdk-linux/platform-tools:$PATH
outfile=list.$(date +%F)
adb devices
echo "Do you see your device? [y|N]"
@larsvilhuber
larsvilhuber / etoggle.tex
Created December 15, 2017 13:23
Use of toggle in latex
\usepackage{etoolbox}
\newtoggle{final}
\newtoggle{blind}
%\togglefalse{final}
\toggletrue{final}
%\toggletrue{blind}
\togglefalse{blind}