Skip to content

Instantly share code, notes, and snippets.

@lolow
lolow / install-sharelatex.md
Last active March 10, 2017 15:53
how to install and setup sharelatex on ubuntu 16.04

dependencies

database and stuff

sudo apt-get update
sudo apt-get install -y redis-server
sudo apt-get install -y mongodb

docker

sudo apt-get install -y apt-transport-https ca-certificates
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

file_ <- function(){
for (i in -(1:sys.nframe())) {
if (identical(args(sys.function(i)), args(base::source)))
return(normalizePath(sys.frame(i)$ofile))
}
cmd_args <- commandArgs(trailingOnly = FALSE)
cmd_args_trailing <- commandArgs(trailingOnly = TRUE)
leading_idx <- seq.int(from = 1, length.out = length(cmd_args) -
length(cmd_args_trailing))
cmd_args <- cmd_args[leading_idx]
#! /bin/sh
# Enable fira code font ligature for rstudio installed by the arch AUR installation
# Please ensure you can edit the file [run with sudo ;)]
sed -i '/<body>/a <style>*{text-rendering: optimizeLegibility;}</style>' /usr/lib/rstudio/www/index.htm
@lolow
lolow / seafile-merge-fixer.py
Created June 6, 2016 20:04 — forked from nyanpasu64/seafile-merge-fixer.py
Seafile merge fixer (replace remote with local state by renaming files)
#!/usr/bin/env python3
import os
import sys
import re
import shutil
from pathlib import Path
# Check R version (>=3.2.0)
if((as.numeric(version$major)<3) | (as.numeric(version$major)==3)&(as.numeric(version$minor)<2) ){
stop('Please use R with a version > 3.2.0 to run the script')
}
# default loading (from R CRAN)
require_package <- function(package){
if(!suppressMessages(suppressWarnings(require(package, character.only = TRUE, quietly = TRUE)))) {
try(install.packages(package, repos="http://cran.r-project.org"), silent = TRUE)
suppressPackageStartupMessages(library(package,character.only=T, quietly = TRUE))
# Test of Significance, takes the same arguments as t.test() .
signif.test <- function(x, ...) {
p <- t.test(x, ...)$p.value
# List of p excuses retrieved from http://mchankins.wordpress.com/2013/04/21/still-not-significant-2/
p_excuses <- c(
"(barely) not statistically significant <p>",
"a barely detectable statistically significant difference <p>",
"a borderline significant trend <p>",
"a certain trend toward significance <p>",

RStudio developers are really hard working. Somehow in their spare time they have worked on their shiny package for making interactive web pages. This gist compares writing a shiny web app to writing a similar app using gWidgetsWWW2.rapache. We only look here at the code, not the deployment. In general, deploying a shiny app widely seems best suited for RStudio's service, currently in beta, though clearly a local shiny app is also quite useful. Deploying an app under gWidgetsWWW2.rapache is fairly easy -- though not very widely tested.

We follow the tkdensity.R GUI from the tcltk package for comparison. This is a standard example with some controls and a resulting graphic. It is right up shiny's alley. We compare to the manipulate commands which mimic RStudio's manipulate pacakge and to straight gWidgetss:

There are 4 files:

  • a file showing how to do this with manipulate (this is an example from the gWidgetsWWW2.rapache package)
  • a file showing gWidgetsWWW2.rapache style (both have a w
# Download cygwin setup.exe from http://www.cygwin.com/setup.exe and install with wget package.
#
# Run cygwin.bat with Administrator rights
cd /tmp
wget http://apt-cyg.googlecode.com/svn/trunk/apt-cyg
chmod +x apt-cyg
mv apt-cyg /bin/apt-cyg
# make local disk mounts available under root (instead of /cygdrives)