Skip to content

Instantly share code, notes, and snippets.

View Midnighter's full-sized avatar

Moritz E. Beber Midnighter

View GitHub Profile
@Midnighter
Midnighter / Dockerfile
Created August 20, 2018 18:13
A basic Docker image for running API Star with gunicorn and uvicorn workers on Alpine Linux
FROM python:3.6-alpine3.7
ENV PYTHONUNBUFFERED=1
WORKDIR /app
COPY Pipfile* ./
RUN set -eux \
&& apk add --no-cache --virtual .build-deps build-base \
@Midnighter
Midnighter / Dockerfile
Created August 19, 2018 18:48
A basic docker image definition for running API Star with gunicorn and uvicorn workers.
FROM python:3.6-slim
ENV PYTHONUNBUFFERED=1
RUN mkdir -p /app
WORKDIR /app
COPY Pipfile* ./
@Midnighter
Midnighter / symengine_slots.ipynb
Last active August 13, 2018 16:33
A Jupyter notebook that explores `__slots__` in symengine 0.3.0
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Midnighter
Midnighter / .block
Last active August 6, 2018 17:33
A prototype for hyper nodes
license: apache-2.0
height: 500
border: no
@Midnighter
Midnighter / Dockerfile
Last active May 22, 2018 11:35
A minimal Python 3.6 Dockerfile intended for microservices that need libc. Sets up an unprivileged user and expects the use of pipenv, gunicorn, and gevent.
FROM python:3.6-slim
ENV PYTHONUNBUFFERED=1
ENV APP_USER=giraffe
ARG UID=1000
ARG GID=1000
ARG CWD=/app
@Midnighter
Midnighter / orphan_branch.ipynb
Last active April 11, 2017 10:19
Showing gitpython's problem with orphan branch.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Midnighter
Midnighter / standard_header.py
Created February 20, 2017 15:23
Insert standardized Python headers into one or more files.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Insert standardized Python headers into one or more files."""
from __future__ import (absolute_import, print_function)
import io
import re
import sys
@Midnighter
Midnighter / postmkvirtualenv
Last active January 25, 2017 07:26 — forked from jlesquembre/postmkvirtualenv
link PyQt components into new virtualenv after creation (`postmkvirtualenv`)
#!/usr/bin/env bash
# This hook is run after a new virtualenv is activated.
#set -e # abort after any errors
#set -u # exit after accessing an undefined variable
libs=(PyQt4 sip.so sipconfig.py)
python_version=python$(python -c "import sys; print (str(sys.version_info[0])+'.'+str(sys.version_info[1]))")
var=( $(which -a ${python_version}) )
@Midnighter
Midnighter / language_spec.rb
Created November 12, 2016 18:10
Rspec file that throws 27 errors using rubocop-rspec.
require 'rails_helper'
require 'set'
module Multilingual
shared_examples 'a valid language' do
it 'its Factory is valid' do
expect(lang).to be_valid
end
context 'is invalid when @code is' do
@Midnighter
Midnighter / rails_unscope_subquery.rb
Created August 29, 2016 23:12
Show unscope behavior on subqueries
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
gem "rails", github: "rails/rails"