Skip to content

Instantly share code, notes, and snippets.

View OElesin's full-sized avatar

Olalekan Fuad Elesin OElesin

View GitHub Profile
@OElesin
OElesin / web-scraper.py
Created July 3, 2023 19:35
Covenant Nation Web Scraper to AWS S3
from bs4 import BeautifulSoup
import re
from urllib.parse import unquote
import time
import boto3, json, os
import requests
from bs4 import BeautifulSoup
s3 = boto3.client('s3')
@OElesin
OElesin / raspberry-pi-with-amazon-lookout-for-vision.py
Last active March 13, 2021 23:09
Detect Anomalies with Amazon Lookout for Vision and publish to Amazon Kinesis Data Firehose
from time import sleep, time
from picamera import PiCamera
from datetime import datetime, timedelta
from boto3 import client
import json
import os
firehose = client('firehose')
lookout_vision = client('lookoutvision')
@OElesin
OElesin / TikaParquetParser.scala
Created May 9, 2018 19:39
Apache Tika Parquet Parser in Scala. You can add this to your project to read parquet files with Apache Tika
import java.io.{File, FileOutputStream, IOException, InputStream}
import java.util
import scala.collection.JavaConverters._
import org.xml.sax.{ContentHandler, SAXException}
import org.apache.tika.metadata.Metadata
import org.apache.tika.metadata.HttpHeaders.CONTENT_TYPE
import org.apache.tika.mime.MediaType
import org.apache.tika.parser.{AbstractParser, ParseContext}
import org.apache.commons.io.IOUtils
def avgTime(message: String, f: => Any) {
var avg = 0L
val c = 42
1 to c foreach {
_ =>
val t0 = System.nanoTime()
f
val t1 = System.nanoTime()
avg += t1 - t0
}
@OElesin
OElesin / how-to-squash-commits-in-git.md
Created April 14, 2018 08:17 — forked from patik/how-to-squash-commits-in-git.md
How to squash commits in git

Squashing Git Commits

The easy and flexible way

This method avoids merge conflicts if you have periodically pulled master into your branch. It also gives you the opportunity to squash into more than 1 commit, or to re-arrange your code into completely different commits (e.g. if you ended up working on three different features but the commits were not consecutive).

Note: You cannot use this method if you intend to open a pull request to merge your feature branch. This method requires committing directly to master.

Switch to the master branch and make sure you are up to date:

@OElesin
OElesin / Sendy.md
Created March 24, 2017 12:19 — forked from dovy/Sendy.md

Sendy

Sendy is a self hosted email newsletter application that lets you send trackable emails via Amazon Simple Email Service (SES).

Heroku

You can deploy Sendy on Heroku using the following instructions (I assume you've already installed the heroku toolbelt).

  1. On Heroku, create a new app.
  2. Clone that app to your desktop
@OElesin
OElesin / date.sql
Created February 27, 2017 14:16
MySQL Date Dimension Build Script
/* Adapted from Tom Cunningham's 'Data Warehousing with MySql' (www.meansandends.com/mysql-data-warehouse) */
###### small-numbers table
DROP TABLE IF EXISTS numbers_small;
CREATE TABLE numbers_small (number INT);
INSERT INTO numbers_small VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
###### main numbers table
DROP TABLE IF EXISTS numbers;
CREATE TABLE numbers (number BIGINT);
@OElesin
OElesin / gist:fa75903000899293cefd83c18566849e
Created February 6, 2017 09:29 — forked from benshimmin/gist:4088493
Scale to fit and centre-align an image with FPDF
<?php
/* Caveat: I'm not a PHP programmer, so this may or may
* not be the most idiomatic code...
*
* FPDF is a free PHP library for creating PDFs:
* http://www.fpdf.org/
*/
require("fpdf.php");
class PDF extends FPDF {
@OElesin
OElesin / gist:d73329202559b7e3c083aadb45334729
Created December 13, 2016 11:58 — forked from debasishg/gist:8172796
A collection of links for streaming algorithms and data structures
  1. General Background and Overview
@OElesin
OElesin / springer-free-maths-books.md
Created November 1, 2016 00:24 — forked from bishboria/springer-free-maths-books.md
Springer made a bunch of books available for free, these were the direct links