Skip to content

Instantly share code, notes, and snippets.

View nyimbi's full-sized avatar

Nyimbi Odero nyimbi

  • Datacraft
  • Nairobi
View GitHub Profile
@nyimbi
nyimbi / autoscraper-examples.md
Created February 21, 2022 06:31 — forked from alirezamika/autoscraper-examples.md
AutoScraper Examples

Grouping results and removing unwanted ones

Here we want to scrape product name, price and rating from ebay product pages:

url = 'https://www.ebay.com/itm/Sony-PlayStation-4-PS4-Pro-1TB-4K-Console-Black/203084236670' 

wanted_list = ['Sony PlayStation 4 PS4 Pro 1TB 4K Console - Black', 'US $349.99', '4.8'] 

scraper.build(url, wanted_list)
@nyimbi
nyimbi / accounting.sql
Created November 22, 2021 18:17 — forked from 001101/accounting.sql
Basic double-entry bookkeeping system, for PostgreSQL.
CREATE TABLE accounts(
id serial PRIMARY KEY,
name VARCHAR(256) NOT NULL
);
CREATE TABLE entries(
id serial PRIMARY KEY,
description VARCHAR(1024) NOT NULL,
amount NUMERIC(20, 2) NOT NULL CHECK (amount > 0.0),
-- Every entry is a credit to one account...
@nyimbi
nyimbi / countries.sql
Created November 20, 2021 03:21 — forked from ereli/countries.sql
Sql dump of all the Countries, Country Codes, Phone codes. PostgreSQL compatible
CREATE SEQUENCE country_seq;
CREATE TABLE IF NOT EXISTS country (
id int NOT NULL DEFAULT NEXTVAL ('country_seq'),
iso char(2) NOT NULL,
name varchar(80) NOT NULL,
nicename varchar(80) NOT NULL,
iso3 char(3) DEFAULT NULL,
numcode smallint DEFAULT NULL,
phonecode int NOT NULL,
@nyimbi
nyimbi / comprehensive_header.py
Created November 1, 2021 13:17 — forked from NicolasBizzozzero/comprehensive_header.py
Python template of a comprehensive header, with shebang, docstring, GPLv3 license and all metadata.
#!/usr/bin/env python
""" Short description of this Python module.
Longer description of this module.
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
@nyimbi
nyimbi / Installing PyICU, libpostal, pypostal on Mac OS X 10.14+.md
Created August 28, 2021 07:29 — forked from ddelange/Installing PyICU, libpostal, pypostal on Mac OS X 10.14+.md
Installation instructions for libicu-dev, PyICU, libpostal, pypostal on Mac OS X 10.14+

Installing PyICU, libpostal, pypostal on Mac OS X 10.14+

libicu-dev (PyICU dependency)

brew uninstall --ignore-dependencies icu4c
brew install pkg-config icu4c  # keg-only
@nyimbi
nyimbi / Doxyfile
Created July 19, 2021 07:26 — forked from dimitarcl/Doxyfile
Documenting JavaScript with Doxygen
FILTER_PATTERNS =*.js=doxygen.js
i
me
my
myself
we
our
ours
ourselves
you
your
@nyimbi
nyimbi / setup-tor.md
Created April 20, 2021 04:00 — forked from skippednote/setup-tor.md
Setup Tor on macOS

Setup One: Buy a Mac if you don't have one.

Setup Two: Install Homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Setup Three:

@nyimbi
nyimbi / blinker_signal.py
Created April 16, 2021 05:29 — forked from doobeh/blinker_signal.py
Blinker/Signal Flask Example
from flask import Flask, current_app
from blinker import Namespace
app = Flask(__name__)
app.secret_key = 'WOO'
my_signals = Namespace()
def moo_signal(app, message, **extra):