Skip to content

Instantly share code, notes, and snippets.

View EdmundMartin's full-sized avatar
🎯
Focusing

Edmund Martin EdmundMartin

🎯
Focusing
View GitHub Profile
import requests
from bs4 import BeautifulSoup
import time
USER_AGENT = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'}
def fetch_results(search_term, number_results, language_code):
assert isinstance(search_term, str), 'Search term must be a string'
assert isinstance(number_results, int), 'Number of results must be an integer'
package main
import (
"fmt"
"math/rand"
"net/http"
"net/url"
"time"
)
package googlescraper
import (
"fmt"
"github.com/PuerkitoBio/goquery"
"net/http"
"strings"
)
type GoogleResult struct {
@EdmundMartin
EdmundMartin / btree.py
Created November 9, 2019 22:47 — forked from MartinThoma/btree.py
a pure-python B tree implementation
import bisect
import itertools
import operator
class _BNode(object):
__slots__ = ["tree", "contents", "children"]
def __init__(self, tree, contents=None, children=None):
self.tree = tree
self.contents = contents or []
@EdmundMartin
EdmundMartin / bplustree.py
Created November 10, 2019 20:41 — forked from savarin/bplustree.py
Python implementation of a B+ tree
class Node(object):
'''
Base node object.
Each node stores keys and values. Keys are not unique to each value, and
as such values are stored as a list under each key.
Attributes:
order (int): The maximum number of keys each node can hold.
'''
from pynput.mouse import Controller
import time
import random
mouse = Controller()
positions = [
(5, 5),
(100, 100),
(200, 200),