Skip to content

Instantly share code, notes, and snippets.

import requests
class HoverException(Exception):
pass
class HoverAPI(object):
def __init__(self, username, password):
params = {"username": username, "password": password}
r = requests.post("https://www.hover.com/signin", params=params)
@pebreo
pebreo / ngram.py
Last active July 28, 2018 21:02
An n-gram generator in Python (newbie program)
from collections import Counter
from random import choice
import re
class Cup:
""" A class defining a cup that will hold the words that we will pull out """
def __init__(self):
self.next_word = Counter() # will keep track of how many times a word appears in a cup
@pebreo
pebreo / gist:5234142
Created March 24, 2013 23:57
Qt code for looping throgh QTextDocument
QStringList images;
QTextBlock b = document->begin();
while (b.isValid()) {
for (QTextBlock::iterator i = b.begin(); !i.atEnd(); ++i) {
QTextCharFormat format = i.fragment().charFormat();
bool isImage = format.isImageFormat()
if (isImage)
images << format.toImageFormat().name();
}
b = b.next();