Skip to content

Instantly share code, notes, and snippets.

nomad=fromJSON(paste(scan("http://nomadlist.io/api/v1", what="c",sep=""),collapse=""))
nomad.has=function(){names(nomad[3]$cities[[1]])}
nomad.get=function(y){unlist(lapply(nomad[3]$cities,function(x){x[[y]]}))}
nomadCost = as.numeric(nomadvar("nomadCost")[names(nomadvar("nomadCost"))=="USD"])
nomadScore = as.numeric(nomadvar("nomadScore"))
plot(nomadCost, nomadScore)
cost.vs.score = lm(nomadScore ~ nomadCost)
abline(cost.vs.score,col="red")
@eugeneteo
eugeneteo / pipeR-tutorial.diff
Last active August 29, 2015 14:07
pipeR-tutorial gitbook to PDF
$ gitbook --version
1.1.0
$ ebook-convert --version
ebook-convert (calibre 2.5.0)
Created by: Kovid Goyal <kovid@kovidgoyal.net>
sudo npm install gitbook -g
sudo npm install gitbook-plugin-ga
sudo npm install gitbook-plugin-katex
# Install calibre at http://calibre-ebook.com/
{
"metadata": {
"name": "",
"signature": "sha256:ca9fef18c8ba5d081020e90fd0b6e2aca0d619a72b0c58577939f5eeed6c8196"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@eugeneteo
eugeneteo / zombie.c
Last active August 29, 2015 14:14 — forked from codeswimmer/zombie.c
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
int main ()
{
pid_t child_pid;
child_pid = fork ();
if (child_pid > 0) {
This Shiny application is designed to help analysing trading strategies. It is an ongoing project that I improve when time allows. Feel free to get in touch should you have any suggestion.
*How to use the App as it is?
The App uses as input several csv files (one for each strategy). Each file has two columns: date and daily return. There is an example of such a file in the Github repository. The code is essentially made of 3 files.
-ui.R: controls the layout and appearance of the app
-server.R: contains the instructions needed to build the app. You can load as much strategies as you want as long as the corresponding csv file has the right format (see below).
-shinyStrategyGeneral.R: loads the required packages and launches the app
put ui.R and server.R file in a separate directory
In the server.R file change the inputPath, inputFile and keepColumns parameters to match your setting. The first two are self explanatory the third one is a list of column names within the csv file. Keep only date and daily return
## we need the libraries bookdown, knitr, inline, markdown, pryr
system("git clone https://github.com/hadley/adv-r.git")
setwd("adv-r")
library(knitr)
embed_png <- bookdown:::embed_png
rmds <- list.files(pattern = "^.*rmd$")
sapply(rmds, function(x) knit(x))
cat("---\ntitle: Advanced R\nauthor: Hadley Wickham\nlanguage: en-US\n...\n",
file = "front_matter.txt")
## assuming we installed pandoc via cabal
@eugeneteo
eugeneteo / scaladays2014.md
Created December 19, 2015 13:09 — forked from kevinwright/scaladays2014.md
Scaladays 2014 slides

As compiled by Kevin Wright a.k.a @thecoda

(executive producer of the movie, and I didn't even know it... clever huh?)

please, please, please - If you know of any slides/code/whatever not on here, then ping me on twitter or comment this Gist!

This gist will be updated as and when I find new information. So it's probably best not to fork it, or you'll miss the updates!

Monday June 16th

$ aws iam create-user --user-name emr
{
"User": {
"UserName": "emr",
"Path": "/",
"CreateDate": "2016-03-11T14:32:08.782Z",
"UserId": "AIDAID746LKJUJI5SGLOC",
"Arn": "arn:aws:iam::548698731369:user/emr"
}
}
$ aws iam attach-user-policy --policy-arn arn:aws:iam::aws:policy/AmazonElasticMapReduceFullAccess --user-name emr
$ cat iam-get-user.json
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"iam:GetUser"
],
"Effect": "Allow",
"Resource": "arn:aws:iam::548698731369:user/emr"