Skip to content

Instantly share code, notes, and snippets.

View mjhea0's full-sized avatar

Michael Herman mjhea0

View GitHub Profile
anonymous
anonymous / peterspurepythonpicopdf.py
Created May 25, 2014 21:15
Peter's pure Python PicoPDF: Create a PDF in 100 lines of Python
from datetime import datetime
from zlib import compress
def serialize(x):
if isinstance(x, dict):
return '<<' + '\n'.join(serialize(k) + ' ' + serialize(v) for k, v in x.items()) + '>>'
if isinstance(x, list):
return '[' + ' '.join(serialize(it) for it in x) + ']'
return str(x)
@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active May 23, 2024 12:17
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@a-laughlin
a-laughlin / gist:1035d616c666271e1fe3
Created June 18, 2014 01:23
Bookmarklet to quickly switch between a repo and the gh-pages (github.io) view.
// Instructions. Save as a bookmark. Click when on a repo or github.io (gh-pages branch) site.
javascript:(function(h,p){
location = /io$/.test(h) ?
'https://github.com/' + h.split('.')[0] + p:
'http://'+ p.split('/')[1]+'.github.io'+ '/' + p.split('/').slice(2).join('/')
})(location.host,location.pathname);
location /webhook/17cbb307-94ec-446b-a17b-ab82594c974c {
if ($request_method != 'POST') {
return 405;
}
content_by_lua 'ngx.print(io.popen("/path/to/script.sh"):read("*a"))';
}
@staltz
staltz / introrx.md
Last active June 6, 2024 03:19
The introduction to Reactive Programming you've been missing
@theikkila
theikkila / keywords.json
Last active November 24, 2021 14:21
7000 skill keywords
[
"Automotive",
"Budgeting",
"HVAC",
"Heaters",
"Hydraulics",
"Logistics Management",
"Management",
"Negotiation",
"Project Planning",
@m3nu
m3nu / md2pdf.py
Last active November 21, 2016 18:34
md2pdf - Command line Markdown to PDF converter with support for CSS stylesheets and custom fonts
#!/usr/bin/env python
import os
import sys
from markdown2 import markdown
from xhtml2pdf import pisa
"""
## Inspired by
@vkroz
vkroz / Python frequent stuff.md
Last active June 14, 2021 12:09
Examples of mocking python unit tests

Virtual environments with Anaconda

List virtual environments

conda info --envs

Create virtual environment

conda create -n yourenvname python=x.x
#!flask/bin/python
from flask import Flask, jsonify, abort, request, make_response, url_for
from flask.ext.httpauth import HTTPBasicAuth
app = Flask(__name__, static_url_path = "")
auth = HTTPBasicAuth()
@auth.get_password
def get_password(username):
@benjamingr
benjamingr / gist:0237932cee84712951a2
Last active October 6, 2023 08:31
Promise unhandled rejection tracking global handler hook

Possibly Unhandled Rejection NodeJS Promise Hook

###Unhandled Rejection Tracking

Several promise libraries such as bluebird and when as well as some native promise implementations offer potentially unhandled rejection tracking. This means that the following:

Promise.reject(new Error("err")); // never attach a `catch`