Skip to content

Instantly share code, notes, and snippets.

View mjhea0's full-sized avatar

Michael Herman mjhea0

View GitHub Profile
@mjhea0
mjhea0 / python_blackjack.py
Last active May 1, 2024 17:03
python blackjack
import os
import random
deck = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]*4
def deal(deck):
hand = []
for i in range(2):
random.shuffle(deck)
card = deck.pop()

github.js

Client-side Javascript API wrapper for GitHub

Tries to map one-to-one with the GitHub API V2, but in a Javascripty manner.

(function (globals) {

Before we implement the API methods, we will define all of our private variables and helper functions with one var statement.

@mjhea0
mjhea0 / audit_mixin.py
Created December 7, 2016 14:12 — forked from techniq/audit_mixin.py
Useful SQLAlchemy Mixins
from datetime import datetime
from sqlalchemy import Column, Integer, DateTime, ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declared_attr
from flask_security import current_user
class AuditMixin(object):
created_at = Column(DateTime, default=datetime.now)
updated_at = Column(DateTime, default=datetime.now, onupdate=datetime.now)
@mjhea0
mjhea0 / admin.py
Created March 7, 2024 16:18 — forked from noviluni/admin.py
Large Table Paginator for Django: Scale Django admin pages and avoid timeouts.
from django.contrib.admin import ModelAdmin
from .paginator import LargeTablePaginator
class MyTableAdmin(ModelAdmin):
...
paginator = LargeTablePaginator
show_full_result_count = False # Recommended to avoid another count()
...
const fs = require('fs');
const path = require('path');
const AWS = require('aws-sdk');
const { BUCKET_NAME, AWS_ACCESS_ID, AWS_SECRET_KEY } = process.env;
// helpers
function uploadToS3(file, name, type) {
@mjhea0
mjhea0 / 1 - sql_interview_questions.md
Last active November 10, 2023 01:06
Jitbit's SQL interview questions
@mjhea0
mjhea0 / resume.md
Last active February 22, 2023 06:12
Michael Herman - Sample Projects (last updated 10/20/13)
@mjhea0
mjhea0 / README.md
Created July 3, 2016 19:27 — forked from alextucker/README.md
Installing Dokku and Deploying a Django App

Install a 3-Node Kubernetes Cluster on Centos 7

This setup uses 3 machines:

  1. Centos7
  2. 100GB HDD
  3. 32 GB RAM
  4. 8 CPU

All Machines

mkdir bottle
cd bottle
pip install virtualenv==12.0.7
virtualenv venv
source venv/bin/activate
pip install bottle==0.12.8
pip freeze > requirements.txt
git init
git add .
git commit -m "initial commit"