Skip to content

Instantly share code, notes, and snippets.

@jkern
jkern / Lisa10.py
Created November 15, 2010 02:07
LISA 10 Weigher
#!/usr/bin/python
import urllib2
import json
import base64
import operator
import math
PAGE = 1
BASE_URL='http://search.twitter.com/search.json?q=%23lisa10&rpp=100&until=2010-11-12&page='
== Rules ==
On Infrastructure
-----------------
There is one system, not a collection of systems.
The desired state of the system should be a known quantity.
The "known quantity" must be machine parseable.
The actual state of the system must self-correct to the desired state.
The only authoritative source for the actual state of the system is the system.
The entire system must be deployable using source media and text files.
# Download Zenoss Source
wget http://downloads.sourceforge.net/project/zenoss/zenoss-2.5%20%28Latest%20Stable%29/zenoss-2.5.1/zenoss-2.5.1.tar.gz
# Extract the wmi directory
tar zxvf zenoss-2.5.1.tar.gz
cd zenoss-2.5
tar zxvf
cd
# Install autoconf
sudo aptitude install autoconf
# Patch the GNUmakefile
[Systems.Diagnostics.Process]::GetProcesses()
# is the same as
Get-Process
#!/usr/bin/python
"""
Kenneth Bump Jr.
WIS 290
Fall block 2 2009"""
""" Horizontal Histogram question 1 wis 290 mid-term """
# pring number 0 to 9 in vertical format
# count how many times the numbers are randomly seleced until the count of 100
# print how many time the numbers are selected next to its number
#!/usr/bin/python
""" This is a random horizontal histogram.
By Eugene Brinkley
WIS 290 Fall Block II
Midterm Horizontal Histogram
Fall Block II 2009"""
#Block imports random and generatres 100 random numbers
; Writing bytes to a file, and timing the execution
(defun filer (path)
(with-open-file (s path
:direction :output
:if-exists :supersede
:if-does-not-exist :create
:element-type 'unsigned-byte)
(loop repeat (* (expt 2 20) 100) ;100MB
@jkern
jkern / Disky The Disk Benchmarker
Created December 2, 2009 20:58
Disky The Disc Benchmarker
#!/usr/bin/python
# This is a great function for timing a function
def timer(fun):
"""timer takes the input of a function and returns the clock() time"""
from time import clock
start = clock()
fun
return clock()-start
def filer(path, data):
import random # Let's just keep this line. And move on -- jkern
counter = 0 # So we want to count how many times we do something. -- jk
num0 = 0
while counter < 100: # Here let's do something until counter is 99. -- jk
number = random.randrange(0,9) # Now we're creating a random number. --jk
if number == 0: # You'll need to check for all the numbers. -- jk
num0 += 1
counter += 1
#!/usr/bin/python
""" This Program prints a horizontal histogram of 100 random digits
By: Larry Harvey
WIS 290
MidTerm Exam