This file contains hidden or 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
library(RPostgreSQL) | |
drv <- dbDriver("PostgreSQL") | |
con <- dbConnect(drv, dbname="6", user="postgres", host="192.168.132.111") | |
# dbListConnections(drv) | |
# dbGetInfo(drv) | |
# summary(con) | |
rs <- dbSendQuery(con," | |
SELECT | |
delta, delta_cnt , |
This file contains hidden or 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
fsvsbs <- read.csv("~/fsvsbs.csv", sep=";") | |
fsvsbs$rel_err = fsvsbs$rel_err*100 | |
plot( | |
fsvsbs$rel_err ~ fsvsbs$delta, | |
xlab="Step / Sub-range Length (sec)", | |
ylab="Relative Error (%)", | |
main="Relative Error of Bandwidth Estimate Based On Flow Sample") | |
nls_fit <- nls(rel_err ~ a + b * delta^(-c), fsvsbs, start = list(a = 43, b = 4, c = 0.2)) | |
lines(fsvsbs$delta, predict(nls_fit), col="red",lwd=3) |
This file contains hidden or 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
# install.packages("RPostgreSQL") | |
# install.packages("zoo") | |
# Notes: EMA - Exponential moving average with alpha=0.05 | |
library(RPostgreSQL) | |
library(TTR) | |
drv <- dbDriver("PostgreSQL") | |
##con <- dbConnect(drv, dbname="probedb", user="postgres", host="192.168.132.111") | |
con <- dbConnect(drv, dbname="1", user="postgres", host="192.168.132.111") |
This file contains hidden or 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
def straddr2int(addr): | |
""" | |
converts IPv4 address inot an integer | |
>>> str2int('192.168.129.43') | |
3232268587 | |
""" | |
return reduce( lambda a,b: a<<8|b, map(int,addr.split('.')) ) |
This file contains hidden or 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
# Include the Dropbox SDK libraries | |
from dropbox import client, rest, session | |
# Get your app key and secret from the Dropbox developer website | |
APP_KEY = 'KEYKEYKEY' | |
APP_SECRET = 'SECRET' | |
# ACCESS_TYPE should be 'dropbox' or 'app_folder' as configured for your app | |
ACCESS_TYPE = 'dropbox' ### 'app_folder' |
NewerOlder