Skip to content

Instantly share code, notes, and snippets.

View larsvilhuber's full-sized avatar

Lars Vilhuber larsvilhuber

View GitHub Profile
@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 / 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 / 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 / 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 / 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}
@larsvilhuber
larsvilhuber / convert_bepress_metadata.py
Last active February 26, 2018 19:53
Script to convert CSV to OJS metadata format (approximately Bepress import from non-standard metadata)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 17 11:40:28 2017
@author: vilhuber
"""
# Replaced by https://github.com/journalprivacyconfidentiality/jpc-migration/releases/tag/1.0
@larsvilhuber
larsvilhuber / gitcreate.sh
Created March 26, 2018 18:26 — forked from robwierzbowski/gitcreate.sh
A simple litte script. Create and push to a new github repo from the command line.
#!/bin/bash
# https://gist.github.com/robwierzbowski/5430952/
# Create and push to a new github repo from the command line.
# Grabs sensible defaults from the containing folder and `.gitconfig`.
# Refinements welcome.
# Gather constant vars
CURRENTDIR=${PWD##*/}
GITHUBUSER=$(git config github.user)