Skip to content

Instantly share code, notes, and snippets.

View Denniskamau's full-sized avatar

Dennis Kamau Denniskamau

View GitHub Profile
@Denniskamau
Denniskamau / bobp-python.md
Created March 30, 2017 05:53 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
{
"kariuki": {
"home": [
"Buy milk",
"Look for pest control service",
"Get a new carpet"
],
"work": [
"Complete the blogpost",
"Create presentation for meeting"
{
"david": {
"id":1,
"name":"David Ngugi",
"verified":1
},
"Victor": {
"id":2,
"name":"Victor Mwangi",
"verified":1
@Denniskamau
Denniskamau / .eslintrc.json
Created June 10, 2018 17:14 — forked from yyscamper/.eslintrc.json
ESLint Airbnb Javascript Standard Configuration (Single File Version)
{
"rules": {
"strict": [
"error",
"never"
],
"import/no-unresolved": [
"error",
{
"commonjs": true,
@Denniskamau
Denniskamau / Kenya Postal code and town Data
Created July 28, 2018 10:39
All the postal codes and their respective towns JSON
{
"10100": "Nyeri",
"10101": "Karatina",
"10102": "Kiganjo",
"10103": "Mukurweini",
"10104": "Mzeiga",
"10105": "Naro Moru",
"10106": "Othaya",
"10107": "Endarasha",
"10108": "Giakanja",
@Denniskamau
Denniskamau / introrx.md
Created February 24, 2020 16:39 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@Denniskamau
Denniskamau / scapper.py
Last active April 14, 2020 14:41
Getting started with web scrapping for image data example
import urllib.request
from bs4 import BeautifulSoup
class Scrapper():
def initializeScrapping(self,url):
# Set the url of the page you want to scrap for data\
urlpage = url
# Using urllib open the page
page = urllib.request.urlopen(urlpage)
@Denniskamau
Denniskamau / webscraper.py
Last active April 14, 2020 14:20
initialize scrapper class
class Scrapper():
def initializeScrapping(self,url):
# Set the url of the page you want to scrap for data\
urlpage = url
# Using urllib open the page
page = urllib.request.urlopen(urlpage)
#Parse the webpage
soup = BeautifulSoup(page, 'html.parser')
# Get the page data from the div with a class of product list view
producet_list = soup.find('div',class_="prod-list-view")
@Denniskamau
Denniskamau / startscrapping.py
Created April 14, 2020 14:23
start scrapping method
...
def startScrapping(self,items,book_data):
#Get the current working directory
current_directory = os.getcwd()
# Create a folder named books to store the srapped images
path = os.path.join(current_directory,r"books")
self.createDirectory(path)
counter = 1
#Loop through the product list
@Denniskamau
Denniskamau / createdirectory.py
Created April 14, 2020 14:24
create directory
...
def createDirectory(self,path):
# Create directory to store the images
try:
os.mkdir(path)
except Exception as e:
print ("Creation of the directory failed",e )
else:
print ("Successfully created the directory %s " % path)