Skip to content

Instantly share code, notes, and snippets.

View mkoistinen's full-sized avatar

Martin Koistinen mkoistinen

  • Chapel Hill, NC, USA
View GitHub Profile
> tox -r -e py34-django17-cms32
GLOB sdist-make: /Users/mkoistinen/repos/djangocms-text-ckeditor/setup.py
py34-django17-cms32 inst-nodeps: /Users/mkoistinen/repos/djangocms-text-ckeditor/.tox/dist/djangocms-text-ckeditor-2.7.2.zip
py34-django17-cms32 installed: coverage==4.0.3,dj-database-url==0.4.1,Django==1.9.5,django-classy-tags==0.7.2,django-cms==3.3.0.dev4,django-formtools==1.0,django-sekizai==0.9.0,Django-Select2==4.3.2,django-treebeard==4.0,djangocms-admin-style==1.1.1,djangocms-helper==0.9.4.post2,djangocms-link==1.7.2,djangocms-picture==1.0.0,djangocms-text-ckeditor==2.7.2,docopt==0.6.2,html5lib==0.9999999,mock==2.0.0,pbr==1.9.1,Pillow==3.2.0,pyflakes==1.1.0,six==1.10.0,South==1.0.2
py34-django17-cms32 runtests: PYTHONHASHSEED='499885356'
py34-django17-cms32 runtests: commands[0] | python setup.py test
running test
running egg_info
writing djangocms_text_ckeditor.egg-info/PKG-INFO
@mkoistinen
mkoistinen / hostels.admin.py
Created May 25, 2016 02:00
Barebones Hostels App and CMSPlugin:
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from .models import Hostel, Room
class RoomInlineAdmin(admin.TabularInline):
@mkoistinen
mkoistinen / home_tags.py
Last active May 26, 2016 14:49
templatetag to get a page object by its ID
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import template
from classytags.arguments import Argument
from classytags.core import Options
from classytags.helpers import AsTag
class CustomPKMixin(object):
"""
Allows a normal SingleObjectMixin view.
"""
pk_field = None
def get_object(self, queryset=None):
"""
Returns the object the view is displaying.
@mkoistinen
mkoistinen / gist:2d8509b0b0be45ed76fed95f89b8596d
Created November 29, 2016 22:46
How to use allow subdomains with CORS
# Basically, since we can't use '*' as a wildcard according to the CORS spec, we need to use
# Nginx to conditionally apply it to the "right" subdomains. This should allow all subdomains
# of `yourtld.tld`.
location ~* ^.+\.(ttf|oft|eot|woff|svg)$ {
#
# NOTE: CORS standards allow a specific protocol/host combination,
# 'null', or '*' only. So, wildcard subdomains won't work.
#
# Have a look here:
Verifying that "mkoistinen.id" is my Blockstack ID. https://onename.com/mkoistinen
@mkoistinen
mkoistinen / .gitprompt
Created September 11, 2018 21:29
Useful Base Prompt for both virtualenvs and Git
# Adds the current branch to the bash prompt when the working directory is
# part of a Git repository. Includes color-coding and indicators to quickly
# indicate the status of working directory.
#
# To use: Copy into ~/.bashrc and tweak if desired.
#
# Based upon the following gists:
# <https://gist.github.com/henrik/31631>
# <https://gist.github.com/srguiwiz/de87bf6355717f0eede5>
# Modified by me, using ideas from comments on those gists.
@mkoistinen
mkoistinen / rate_measured.py
Created August 6, 2019 14:15
Decorator to measure call rate
# -*- coding: utf-8 -*-
import random
import json
import sys
import time
def rate_measured(report_period=10, report_function=None):
"""
@mkoistinen
mkoistinen / Sainsmart TPU.ini
Created November 29, 2019 18:16
Sainsmart TPU for MK3S
# generated by PrusaSlicer 2.0.0+ on 2019-06-30 at 10:59:22
bed_temperature = 65
bridge_fan_speed = 40
compatible_printers =
compatible_printers_condition =
compatible_prints =
compatible_prints_condition =
cooling = 0
disable_fan_first_layers = 4
end_filament_gcode = "; Filament-specific end gcode"
@mkoistinen
mkoistinen / ninjaflex.ini
Created November 29, 2019 18:28
NinjaFlex Settings for Prusa MK3S
# generated by PrusaSlicer 2.1.0+ on 2019-11-29 at 18:25:13 UTC
bed_temperature = 60
bridge_fan_speed = 30
compatible_printers =
compatible_printers_condition = ! (printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK(2.5|3).*/ and single_extruder_multi_material)
compatible_prints =
compatible_prints_condition =
cooling = 0
disable_fan_first_layers = 1
end_filament_gcode = "; Filament-specific end gcode"