Skip to content

Instantly share code, notes, and snippets.

anonymous
anonymous / morningstar.R
Created December 5, 2016 16:46
How to retrieve data from Morningstar
require(RCurl)
require(jsonlite)
myticker<-"FB"
url.histprice<-function(x){ return(paste0("http://globalquote.morningstar.com/globalcomponent/RealtimeHistoricalStockData.ashx?ticker=",x,"&showVol=true&dtype=his&f=d&curry=USD&range=1900-1-1|2014-10-10&isD=true&isS=true&hasF=true&ProdCode=DIRECT"))}
url.keyratios<-function(x){return(paste0("http://financials.morningstar.com/ajax/exportKR2CSV.html?t=",x))}
#Retrieve historical prices
json.histprice<-getURL(url.histprice(myticker))
json.histprice<-sub("NaN","\"NA\"",json.histprice)
@radames
radames / python_opencv_camera_haar.py
Last active January 5, 2021 14:25
Example of Python with Opencv and camera face detection - repo complete https://github.com/radames/python_opencv_camera_haar
import cv2
cap = cv2.VideoCapture(0)
cap.set(3, 640) # WIDTH
cap.set(4, 480) # HEIGHT
face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + "haarcascade_frontalface_default.xml")
eye_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + "haarcascade_eye.xml")
while(True):
@wangruohui
wangruohui / Install NVIDIA Driver and CUDA.md
Last active May 17, 2024 09:02
Install NVIDIA Driver and CUDA on Ubuntu / CentOS / Fedora Linux OS
@karpathy
karpathy / pg-pong.py
Created May 30, 2016 22:50
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4
gamma = 0.99 # discount factor for reward
@tianchaijz
tianchaijz / github-api.py
Last active August 8, 2022 04:17
A python script to clone a specified github user's repos, gists.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import time
import json
import logging
import requests
@fadere
fadere / ebay_scraper.py
Created December 3, 2015 07:21
python code to scrape ebay historical auction results
import csv
import requests
import bs4
import argparse
# parser = argparse.ArgumentParser(description='Process a list of search terms.')
# parser.add_argument('terms', metavar='N', type=str, nargs='+',
# help='comma separated list of terms to search for')
# args = parser.parse_args()
@timelyportfolio
timelyportfolio / Readme.md
Last active March 30, 2020 06:14
some examples with rbokeh inspired by ggplot2 and lattice

lattice

examples inspired by this book

ggplot2

examples inspired by this book

@debasishg
debasishg / gist:b4df1648d3f1776abdff
Last active January 20, 2021 12:15
another attempt to organize my ML readings ..
  1. Feature Learning
  1. Deep Learning
@ericjang
ericjang / currentCPI.py
Last active July 30, 2017 01:00
Python script that returns a pandas dataframe containing global Consumer Price Indices
import requests
from bs4 import BeautifulSoup
import pandas as pd
import re
import sys
def currentCPI:
url = 'http://www.tradingeconomics.com/country-list/consumer-price-index-(cpi)'
r = requests.get(url)
soup = BeautifulSoup(r.text)
@ericjang
ericjang / globalValues.py
Created August 19, 2014 00:06
Python script that retrieves a pandas dataframe containing fundamental stock market valuation ratios
import requests
from bs4 import BeautifulSoup
import pandas as pd
import re
import sys
def globalValues:
url = 'http://www.starcapital.de/research/stockmarketvaluation?SortBy=Shiller_PE'
r = requests.get(url)
if r.status_code != 200: