Skip to content

Instantly share code, notes, and snippets.

@monkut
monkut / python3 build on RHEL72
Created December 1, 2016 04:50
python3 build on RHEL72
python3 install
------------------------
1. install dependencies::
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel li
2. Configure/build make::
@monkut
monkut / SpotifyCassandra-getting-started.md
Last active May 14, 2018 21:05
Using spotify cassandra docker image

https://github.com/spotify/docker-cassandra

getting and starting single-node cassandra

This describes the method to obtain and run the spotify/cassandra single-node instance on ubuntu 16.04 where docker is already installed.

  1. Obtain image
sudo docker pull spotify/cassandra
@monkut
monkut / Ubuntu1604py36Dockerfile
Last active June 14, 2023 20:31
Base Docker image for ubuntu-16.04 & Python3.6
# docker build -t ubuntu1604py36
FROM ubuntu:16.04
RUN apt-get update && \
apt-get install -y software-properties-common && \
add-apt-repository ppa:jonathonf/python-3.6
RUN apt-get update
RUN apt-get install -y build-essential python3.6 python3.6-dev python3-pip python3.6-venv
RUN apt-get install -y git
@monkut
monkut / merge_pdfs.py
Last active August 7, 2017 02:24
Merge Multiple PDFs into 1 with PyPDF2
from PyPDF2 import PdfFileReader, PdfFileMerger
pdfs_to_merge = [
# Page numbers are 0 start
# (FILEPATH, (START_PAGE, UNTIL_PAGE)) -- If None, all pages output
(None, (0, 5),
]
# Creating an object where pdf pages are appended to
@monkut
monkut / github_archive_retriever.py
Created August 14, 2017 01:31
parallel retrieve of github arhive data
"""
Retrieve github archieve data from:
https://www.githubarchive.org/
"""
import datetime
from concurrent.futures import ThreadPoolExecutor
from tqdm import tqdm
@monkut
monkut / aws_and_dask-gettingstarted.md
Last active September 11, 2017 04:10
Getting Started with AWS and Dask

Prereqs

NOTE: this assumes python >= 3.6

On ubuntu make sure that you have the python3.6-dev package installed in order to build the necessary packages

  • python3.6
  • jq

Preparation

@monkut
monkut / ec2_metadata_manager.py
Created November 15, 2017 07:24
Provides a simple (top-level only) wrapper around the AWS ec2 instance metadata interface
import requests
METADATA_URL = 'http://169.254.169.254/latest/meta-data/'
class AmiMetaDataManager:
"""
Provides a simple wrapper around the AWS ec2 instance metadata interface
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html
"""
@monkut
monkut / sample.ipynb
Last active December 8, 2017 05:06 — forked from egradman/sample.ipynb
Simple Google Spreadsheets to Pandas DataFrame in IPython Notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@monkut
monkut / serving-sphinx-docs-on-s3.md
Created May 8, 2018 05:35
Serving Sphinx Documentation on s3

Build your sphinx document

Assumes you already have a sphinx project installed and a project created

make html

By default this command will build documentation to _build/html

@monkut
monkut / lazy_LRUish_redis_cache_decorator.py
Last active December 22, 2021 23:46
A lazy implementation of an lru-ish redis based cache decorator
import json
from functools import wraps
import redis
REDIS_HOST = 'localhost'
REDIS_PORT = 6379
REDIS_CONNECTION_POOL = redis.ConnectionPool(host=REDIS_HOST, port=REDIS_PORT)
CACHE_EXPIRE_SECONDS = 5000