This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# testing the automatic differentiation capabilities | |
using Cairo; | |
using DataFrames; | |
using Gadfly; | |
using ForwardDiff; | |
f(x) = sin(x[1]); | |
x = [-pi:.1:pi]; | |
outf=[f(i) for i in x]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% feigenbaum diagram | |
r = 1:.01:4; % r values | |
nr = length(r); % number of r values | |
nI = 600; % number of iterations to perform for each r | |
converge = 300; | |
p = nan(converge,nr); | |
x = zeros(1,nI); | |
for rx=1:nr | |
x(1)=.5; | |
for i=2:nI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ticker = 'USSPX'; % s&p500 index | |
periods = 1:100; | |
nP = numel(periods); | |
c = yahoo; | |
dates = {'Jan 1 2000','Sep 6 2014'}; | |
prices = fetch(c,ticker,'Adj Close',dates{1},dates{2}); % should I use Close instead? | |
nDays = size(prices,1); | |
nTrials = 50; | |
returns = zeros(nTrials,nP); | |
tP = 50*nDays; % total principal invested over time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ex = quote | |
s = string(ex) | |
o = s | |
array = uint8(collect(s)) | |
for i = 1:length(array), bit = 0:7 | |
if rand() < 1/(length(array)*8) | |
array[i] $= (0x01 << bit) | |
end | |
end | |
s = bytestring(array) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import pdb | |
N_max = int(1e3) # numbers to try out | |
T_max = int(200) # max iterations | |
sequence = np.zeros((N_max, T_max), dtype=int) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#script for parsing Mrs. Cao's file. | |
import csv | |
original = csv.reader(open('/Users/Eric/Desktop/destinations.csv','rU')) | |
f = open('/Users/Eric/Desktop/formattedList.txt', 'w') | |
current = "" | |
for row in original: | |
college = row[2] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//note that this is just basic IP address routing. XSS exploit needed for more accurate location. | |
var http = require('http'); | |
var server = http.createServer(function(req,res){ | |
res.writeHead(200); | |
res.end('Hello HTTP'); | |
console.log('client connected! ip address is ' + req.socket.remoteAddress); | |
}); | |
server.listen(8080); | |
console.log('server listening at localhost:8080. Send your victim over!'); |
NewerOlder