Skip to content

Instantly share code, notes, and snippets.

Matthew Schinckel schinckel

Block or report user

Report or block schinckel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@schinckel
schinckel / pyproject.toml
Created Dec 18, 2019
Invalid requirements.txt generation
View pyproject.toml
[tool.poetry]
name = "foo"
version = "0.1.0"
description = ""
authors = ["Matthew Schinckel <matt@schinckel.net>"]
[tool.poetry.dependencies]
django = [
{version = "==1.11.26", python = "~2.7"},
{version = "*", python = ">=3.6"}
View pyproject.toml
[tool.poetry]
name = "poetry-2.7"
version = "0.1.0"
description = ""
authors = ["Matthew Schinckel <matt@schinckel.net>"]
[tool.poetry.dependencies]
[tool.poetry.dev-dependencies]
View textmate_environment_variables.rb
#!/usr/bin/env ruby
###############################################################
#
# Paste this into a TextMate document,
# press ⇧^⌥R and choose 'Ruby' from the menu that appears,
# and then press ⌘R to run this in the context of TextMate
# to see all TextMate environment variables and their values
#
###############################################################
View textmate_environment_variables.rb
#!/usr/bin/env ruby
###############################################################
#
# Paste this into a TextMate document,
# press ⇧^⌥R and choose 'Ruby' from the menu that appears,
# and then press ⌘R to run this in the context of TextMate
# to see all TextMate environment variables and their values
#
###############################################################
@schinckel
schinckel / data.sql
Created Feb 22, 2015
Ten pin bowling score calculation
View data.sql
-- Game 1
INSERT INTO bowling.frame VALUES
(1, 1, 1, 7, 2, NULL),
(1, 1, 2, 3, 7, NULL),
(1, 1, 3, 6, 4, NULL),
(1, 1, 4, 10, NULL, NULL),
(1, 1, 5, 10, NULL, NULL),
(1, 1, 6, 10, NULL, NULL),
(1, 1, 7, 9, 1, NULL),
(1, 1, 8, 10, NULL, NULL),
View Boiled Chocolate Cake
Boil together:
* 125g butter
* 1 cup water
* 1 1/2 cups sugar
* 2 tablespoons cocoa
* 1/2 teaspon bicarb soda
Simmer 5 mins.
@schinckel
schinckel / install.sh
Last active Aug 9, 2017 — forked from bradrydzewski/install.sh
Drone.io Install Postgres9.4
View install.sh
#!/bin/bash
# remove existing 9.3 installation
sudo /etc/init.d/postgresql stop
sudo apt-get --force-yes -fuy remove --purge postgresql postgresql-9.1 postgresql-client
# install 9.4
sudo apt-get install python-software-properties
sudo add-apt-repository 'deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main 9.4'
sudo apt-get update
View get-django-view-class
from django.views.generic.base import View
def get_class(func):
if not getattr(func, 'func_closure', None):
return
for closure in func.func_closure:
contents = closure.cell_contents
if not contents:
@schinckel
schinckel / selectable.js
Created Apr 2, 2013
Knockout extension: selectable observableArray
View selectable.js
/*
Provide an observableArray with some smarts related to selection
of an item, or items within it.
If 'multiple' is passed in, then it is a multiply selectable
array, and has two new attributes: ``selectedItems`` and ``selectedIndexes``.
If 'multiple' is not passed in, then it new attributes of
``selectedItem`` and ``selectedIndex`` are created.
@schinckel
schinckel / increment_tcx_dates.py
Created May 22, 2012
Increment all of the dates within a TCX file by a certain amount.
View increment_tcx_dates.py
import re
import datetime
time_re = re.compile('(?P<dt>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})')
offset = datetime.timedelta(minutes=5,seconds=1)
for line in lines:
if time_re.search(line):
time = datetime.datetime.strptime(time_re.search(line).groupdict()['dt'], "%Y-%m-%dT%H:%M:%S")
time = time + offset
You can’t perform that action at this time.