Skip to content

Instantly share code, notes, and snippets.

View BlogBlocks's full-sized avatar

Jack Northrup BlogBlocks

View GitHub Profile
#!/usr/local/bin/python
"""
Converts a date into a fraction of a year
Usage: Takes two arguments month and day.
python dateTodec.py 2 22
"""
from __future__ import division
import sys
import math
import sys, getopt
# Arg test:
# python ArgTest.py eweewe erer tytyytt sssss
import sys
import numpy as np
import sys
script = sys.argv[0]
filename = sys.argv[1]
test0 = sys.argv[2]
test1 = sys.argv[3]
test2 = sys.argv[4]
#Date as year and Decimal
# USAGE: import Date_in_Dec
# Date_in_Dec.Today()
# Returns: 2017.896174863388
import time
def Today():
Date2Day = (float(time.strftime("%j"))-1) / 366 + float(time.strftime("%Y"))
return Date2Day
if __name__=="__main__":
Today()
#!/usr/bin/python
"""
Just playing with randint, lists and plots
Created for Jupyter Notebook
Useage:
import ToyPlot
ToyPlot.toyplot()
"""
import matplotlib.pyplot as plt
from random import randint
# Created for Jupyter Notebook
#learn by experimenting
import matplotlib.pyplot as plt
data=[(215.42,316.31,416.5),(327.56,428.13,338.0),(322.36,448.46,372.7)]
print"A:",([data[0][1]]),\
"\nB:", (data[0][0]),\
"\nC:", (data[0][2]),\
"\nD:", (data[1][1]),\
"\nE:", (data[2]),\
import pylab
Text = """315.42,
316.31,
316.5,
317.56,
318.13,
318,
316.39,
314.65,
313.68,
"""
Learn to download and save a CSV file
open it and read the data
"""
import sys
from itertools import islice
import urllib2
# CO2.csv source
url = 'http://pchart.sourceforge.net/Resources/CO2.csv'
# Open the URL
@BlogBlocks
BlogBlocks / LISTexample.py
Last active December 19, 2017 00:28
Using a list from first to last entry or last to first by removing items on the list
"""
Demonstration:
How to remove elements one at a time from a list.
front to rear, then rear to front
"""
from time import sleep
ID = [750,771,772,1000,1077,1099,1110,1277,1499, 2000, 20050, 20167]
count = 0
inc = len(ID)
while count < inc:
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some scripts to learn how to use sys.argv
ArgTest1.py
#!/usr/local/bin/python
import sys
a = sys.argv[1]
print a
-- tryit:
!python ArgTest1.py 456 721