Skip to content

Instantly share code, notes, and snippets.

View kingbuzzman's full-sized avatar

Javier Buzzi kingbuzzman

View GitHub Profile
#!/usr/bin/env python
"""
Check if the requirement versions match between all packages -- otherwise whats going on? which one do we use, this is
not the wild-wild-west -- we have rules
"""
import sys
import os
import urlparse
from pip.req import parse_requirements
# Use an official Python runtime as a parent image
FROM python:2.7-slim
# Set the working directory to /app
WORKDIR /app
# Copy the current directory contents into the container at /app
ADD . /app
# Install any needed packages specified in requirements.txt
@kingbuzzman
kingbuzzman / LDAP.md
Last active February 3, 2018 10:51
Working progressing of ldap configuration with docker

Installation steps...

All information was inspired by: https://www.darold.net/projects/ldap_pg/HOWTO/index.html

Install all the deps (assuming docker)

apt-get update; sed -i "s/^exit 101$/exit 0/" /usr/sbin/policy-rc.d; apt-get install -y postgresql-client slapd ldap-utils iodbc odbc-postgresql vim unixodbc

Files needed

@kingbuzzman
kingbuzzman / jwt_test.py
Last active February 29, 2024 15:59
JWT test with private/public keys
import jwt
import time
import datetime
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
# Load the key we created
with open("mykey.pem", "rb") as key_file:
private_key = serialization.load_pem_private_key(
FROM alpine:3.7
MAINTAINER blah-blah <[email protected]>
RUN echo "http://dl-2.alpinelinux.org/alpine/v3.7/main" >> /etc/apk/repositories && \
echo "http://dl-3.alpinelinux.org/alpine/v3.7/main" >> /etc/apk/repositories && \
echo "http://dl-4.alpinelinux.org/alpine/v3.7/main" >> /etc/apk/repositories && \
echo "http://dl-5.alpinelinux.org/alpine/v3.7/main" >> /etc/apk/repositories
RUN apk --update --no-cache add python py2-pip docker
RUN pip install --upgrade pip setuptools nsenter
@kingbuzzman
kingbuzzman / commit_to_django.sh
Last active September 21, 2018 15:54
Fork django / commit to it using docker
# Steps to running django quickly to make a PR.
# 1. Fork django on github: https://github.com/django/django
# 2. Make sure that you've setup your ssh keys for github: https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/
# IMPORTANT: *** Please ignore if you've already done it ***
# 3. Copy and paste this directly into your terminal:
docker run -v $(pwd)/django:/django -v ~/.ssh:/root/.ssh -v ~/.gitconfig:/root/.gitconfig -it --rm python:3.7 bash -c '
# update the machine
apt-get update && \
# install dependencies
apt-get install -y libmemcached-dev zlib1g-dev libssl-dev build-essential vim && \
import requests
import bs4
import urllib
session = requests.Session()
res = session.get('https://awseabmgmt.signin.aws.amazon.com/console')
res2 = session.get(res.url +'?state=hashArgs%23')
form = bs4.BeautifulSoup(res2.content).find('form')
data['username'] = '**********'
data['account'] = '**********'
data['password'] = '**********'
@kingbuzzman
kingbuzzman / Makefile
Created November 21, 2018 11:14
issue with line 42
SHELL := /bin/bash
# To debug uncomment this line
SHELL := /bin/bash -x
PRJ_BASE_PATH := $(shell pwd)
PRJ_SLUG ?= $(shell basename $(PRJ_BASE_PATH))
PRJ_VERSION ?= 1.0.9
PRJ_DOCKER_REGISTRY ?= uffizi.a9.ga
PRJ_COMPOSE_DIR ?= compose
PRJ_TARGETS ?= $(shell ls $(PRJ_BASE_PATH)/$(PRJ_COMPOSE_DIR) | grep -v "frontend")
# Steps to running factory_boy quickly to make a PR.
# 1. Fork factory_boy on github: https://github.com/FactoryBoy/factory_boy
# 2. Make sure that you've setup your ssh keys for github: https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/
# IMPORTANT: *** Please ignore if you've already done it ***
# 3. Copy and paste this directly into your terminal:
docker run -v ${pwd}/factory_boy:/factory_boy -v ~/.ssh:/root/.ssh -v ~/.gitconfig:/root/.gitconfig -it --rm python:3.9 bash -c '
# update the machine
apt-get update && \
# install dependencies
apt-get install -y mongodb vim && \
@kingbuzzman
kingbuzzman / django_prefix_mixing.py
Last active September 17, 2019 21:49
Adds the ability to add prefixes to django model field names
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Stolen from: https://mlvin.xyz/django-single-file-project.html
import inspect
import os
import sys
from types import ModuleType