Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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/python3 | |
""" | |
http://www.davetromp.net/2017/03/learn-how-to-code-with-python-lesson-1.html | |
Learn how to code with python: Lesson 1 - Hello World! | |
Lesson 1 | |
Basics | |
Programming paradigms | |
- Scripting *** | |
- Procedural ** | |
- Object oriented * |
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 urllib.request | |
def getData(ticker): | |
url = "http://chart.finance.yahoo.com/table.csv?s={}&a=1&b=12&c=2017&d=2&e=12&f=2017&g=d&ignore=.csv".format(ticker) | |
data = urllib.request.urlopen(url) | |
doc = open("yahoo_finance_{}.csv".format(ticker), 'w') | |
doc.write(data.read().decode("utf8")) | |
doc.close() | |
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
# the code is explained here: https://youtu.be/Eex4zBc9r7Y | |
import os | |
def main(): | |
files = os.listdir("./") | |
for f in files: | |
if f.lower()[-3:] == "mp4": | |
print "processing", f | |
process(f) |
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 re | |
import time | |
import mechanize | |
br = mechanize.Browser() | |
br.set_handle_robots(False) # ignore robots | |
br.set_handle_refresh(False) # can sometimes hang without this | |
br.addheaders = [('User-agent', 'Firefox')] |
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 | |
## Check out: https://github.com/davetromp/SiteMonitor for the complete and current code | |
import urllib | |
import smtplib | |
import time | |
import datetime | |
import sys |
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 sys | |
# DT 24-2-2013 | |
# This python script will loop through a csv file and put the first column in | |
# in the id field and the second in the description field of a localization file. | |
# The csv file needs to be UTF-8 encoded. Delimiter is a comma, no quotes please. | |
#write the standaard output to a file | |
sys.stdout = open('output.xml', 'w') |
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
@echo off | |
:: This script checks a files size | |
:: If it is less then a certain size, it will be switched by a previous | |
:: version of the file. If the filesize is OK it will be copied to a backup location. | |
setlocal | |
:: location of the file | |
set dir=D:\import |
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
#!/bin/bash | |
# this script will read in a ohlc file from yahoo finance line by line | |
# putting every line in a list / array as an element | |
# and then do some basic calculations on the numbers | |
# we will calculate the absolute return, the avarage daily differences, | |
# the standard deviation of the daily differences and finally the sharp ratio | |
fname=$1 | |
readin(){ |
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
#!/bin/bash | |
################################################################################ | |
# This script will check to see if a website is up/down by pinging the url | |
# If there is no response an email wil be send via an external smtp mail server | |
# If the site status is down an email will be send when the site is up again | |
# set your check interval here :-) ############################################# | |
interval=3600 # hour |
NewerOlder