Skip to content

Instantly share code, notes, and snippets.

View vfulco's full-sized avatar

Vincent C Fulco vfulco

  • Weisisheng Corporate Management Consulting (Shanghai) Ltd.
  • Shanghai, China
View GitHub Profile
@yoavram
yoavram / nbreveal_preview.py
Last active December 14, 2015 18:19
Python web server to preview IPython reveal.js presentations. Automatically converts ipynb to html everytime the ipynb file changes. Requirements: Flask, Watchdog, nbconvert with reveal, copy reveal and js folders from nbconvert to the same folder as the server is at.
from flask import Flask, send_file, send_from_directory
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
import os
NBCONVERT_PATH = '../nbconvert/nbconvert.py'
TARGET_IPYNB = 'presentation.ipynb'
TARGET_HTML = 'presentation_slides.html'
def nbconvert():
@milktrader
milktrader / cot.jl
Last active December 16, 2015 01:38
Commitment of Traders as features of a model
julia> using Quandl, TimeSeries
julia> rut = quandl("YAHOO/INDEX_RUT");
julia> cot_rut = quandl("OFDP/FUTURE_COT_38");
julia> r = merge(rut, cot_rut, "Date");
julia> simple_return!(r, "Close");
@fredrick
fredrick / powermean.r
Last active December 16, 2015 07:48
Generalized/power mean with R
# Power mean
## Examples:
## p = 1, arithmetic mean
## p = 2, quadratic mean (RMS)
pmean <- function(x, p) {
library(TTR)
return(tail(TTR::SMA(x^p, length(x))^(1/p), n=1))
}
@matthiaseisen
matthiaseisen / contact.html
Last active December 17, 2015 18:59
You are probably already familiar with the possibility of hosting static website on Amazon S3. If you're not you should read this great tutorial by Chad Thompson: http://chadthompson.me/2013/05/06/static-web-hosting-with-amazon-s3/. One common problem is that while being static your website still needs a contact form. Here's a solution for this …
<!-- You are probably already familiar with the possibility of hosting static websites on Amazon S3.
If not you should read this great tutorial by Chad Thompson: http://chadthompson.me/2013/05/06/static-web-hosting-with-amazon-s3/.
One common problem is that while being static your website still needs a contact form.
Here's a solution for this problem using Newman API (http://www.newmanapi.com). -->
<html>
<body>
<!-- First we set the 'action' attribute of <form> to point to Newman API -->
<form method="post" action="http://submit.newmanapi.com/" >
<!-- Now we create our input elements as we would in any other form -->
<!-- You are probably already familiar with the possibility of hosting static websites on Amazon S3.
If not you should read this great tutorial by Chad Thompson: http://chadthompson.me/2013/05/06/static-web-hosting-with-amazon-s3/.
One common problem is that while being static your website still needs a contact form.
Here's a solution for this problem using Newman API (http://www.newmanapi.com). -->
<html>
<body>
<!-- First we set the 'action' attribute of <form> to point to Newman API -->
<form method="post" action="http://submit.newmanapi.com/" >
<!-- Now we create our input elements as we would in any other form -->
@timelyportfolio
timelyportfolio / index.html
Last active December 17, 2015 20:09
explore the intended and unintended consequences of fed and boj actions
<!DOCTYPE html>
<!-- saved from url=(0014)about:internet -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Intended Or Unintended Consequence</title>
</head>
@adamwiggins
adamwiggins / adams-heroku-values.md
Last active November 27, 2024 17:06
My Heroku values

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

@hadley
hadley / postmarkapp.r
Created June 4, 2013 17:16
Send an email from R using postmarkapp
library(base64enc)
library(RJSONIO)
library(httr)
default_key <- function () {
key <- Sys.getenv("POSTMARKAPP_API_KEY")
if (key == "") {
stop("Either provide key or set envvar POSTMARKAPP_API_KEY", call. = FALSE)
}
key
@cpatrick
cpatrick / runsearch.py
Last active October 3, 2021 15:18
Sample Python for running a full-text search using PyMongo
from pymongo import Connection
if __name__ == '__main__':
# Connect to mongo
conn = Connection()
db = conn['canepi']
# Set the search term
term = 'foo'
@hadley
hadley / html.r
Last active December 18, 2015 03:58
# We first start by creating a way of escaping the characters that have special
# meaning for html, while making sure we don't end up double-escaping at any
# point. The easiest way to do this is to create an S3 class that allows us to
# distinguish between regular text (that needs escaping) and html (that
# doesn't).
#
# We then write an escape method that leaves html unchanged and escapes the
# special characters (&, <, >) in ordinary text. We also add a method for lists
# for convenience