Skip to content

Instantly share code, notes, and snippets.

@gavinwhyte
gavinwhyte / rocksvsmines.py
Last active October 20, 2015 21:10
Rocks vs mines Machine Learning Classification
__author__ = 'gavinwhyte'
import urllib2
import numpy
import random
from sklearn import datasets, linear_model
from sklearn.metrics import roc_curve, auc
import pylab as pl
def confusionMatrix(predicted, actual, threshold):
if len(predicted) != len(actual): return -1
@ian-weisser
ian-weisser / ncurses_clock.py
Created April 6, 2014 23:45
Python class that adds an easy, independent clock to a Curses window
#!/usr/bin/python3
import curses
import time
import threading
class Clock(threading.Thread):
""" Clock curses string class. Updates every second. Easy to install """
@evansde77
evansde77 / mock_requests.py
Last active January 31, 2024 08:49
Example of mocking requests calls
#!/usr/bin/env python
"""
mocking requests calls
"""
import mock
import unittest
import requests
from requests.exceptions import HTTPError