Skip to content

Instantly share code, notes, and snippets.

View jrovegno's full-sized avatar

jrovegno jrovegno

View GitHub Profile
@jrovegno
jrovegno / std2.py
Created May 13, 2012 01:20
standard deviation of the values
import numpy as np
def std2(x):
sum, sum2, n = 0.0, 0.0, 0.0
for k in x:
sum += k
sum2 += k*k
n += 1
return sum2/n - sum*sum/(n*n)
@jrovegno
jrovegno / std.py
Created May 13, 2012 21:05
standard deviation of the values
from math import sqrt
sum, sum2, n = 0.0, 0.0, 0.0
with open("numeros.txt") as infile:
for line in infile:
k = float(line)
sum += k
sum2 += k*k
n += 1
@jrovegno
jrovegno / std-1.py
Created May 14, 2012 15:34
standard deviation of the values
from math import sqrt
sum, sum2, n = 0.0, 0.0, 0.0
f = open('numeros.txt', 'r')
numbers = f.readlines()
f.close()
for num in numbers:
k = float(num)
sum += k
@jrovegno
jrovegno / std-2.py
Created May 14, 2012 15:54
standard deviation of the values
import numpy as np
f = open('numeros.txt', 'r')
numbers = f.readlines()
f.close()
i = 0
for num in numbers:
numbers[i] = float(num)
i += 1
@jrovegno
jrovegno / hamming.py
Created June 14, 2012 18:42
Desafío 2012-06 El problema de Hamming
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# hamming.py
#
# Copyright 2012 Javier Rovegno Campos <javier.rovegno@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
@jrovegno
jrovegno / colebrook.py
Created June 26, 2012 21:50
Efficient Resolution of the Colebrook Equation
from math import log
def vel(q, a):
"""
Mean Velocity (q[m3/s], a[m2])
q is flow rate
a is cross-sectional area
"""
return q / a
@jrovegno
jrovegno / README.md
Last active August 29, 2015 13:59
IPSA - README is empty

README is empty

@jrovegno
jrovegno / dga_01.rb
Last active December 18, 2015 18:42
Reparado problema con dialogo descarga excel
require 'webdrone'
profile = Selenium::WebDriver::Firefox::Profile.new
profile['startup.homepage_welcome_url.additional'] = 'about:blank'
profile['browser.helperApps.neverAsk.saveToDisk'] = 'images/jpeg, application/pdf, application/octet-stream, application/download, application/vnd.ms-excel'
a0 = Webdrone.create browser: :firefox, timeout: 10, firefox_profile: profile
def entrar_dga(a0)
a0.open.url 'http://dgasatel.mop.cl/'
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jrovegno
jrovegno / delicious2csv.py
Last active January 7, 2016 15:48
Parses a delicious.com bookmark file and transforms it into a list of dictionaries.
#!/usr/bin/env python
#coding:utf-8
# Author: --<>
# Purpose:
# Created: 12/29/10
from HTMLParser import HTMLParser # Python 2
import pandas as pd
# from html.parser import HTMLParser # Python 3