Skip to content

Instantly share code, notes, and snippets.

View schinckel's full-sized avatar

Matthew Schinckel schinckel

View GitHub Profile

MIT License

Copyright (c) 2019-2020 Matthew Schinckel

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

@schinckel
schinckel / pyproject.toml
Created December 18, 2019 05:37
Invalid requirements.txt generation
[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"}
[tool.poetry]
name = "poetry-2.7"
version = "0.1.0"
description = ""
authors = ["Matthew Schinckel <matt@schinckel.net>"]
[tool.poetry.dependencies]
[tool.poetry.dev-dependencies]
@schinckel
schinckel / install.sh
Last active August 9, 2017 18:01 — forked from bradrydzewski/install.sh
Drone.io Install Postgres9.4
#!/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
@schinckel
schinckel / jquery.couch.longpoll.js
Created January 22, 2012 11:29
Long-polling handler for CouchDB
/*
# jquery.couch.longpoll.js #
A handler that can be used to listen to changes from a CouchDB database,
using long-polling.
This seemed to be a bit simpler than using continuous polling, which I
was unable to get working with jQuery.
@schinckel
schinckel / jekyllmarkdown.rb
Created January 9, 2012 14:26
Jekyll renderer for Marked.app
#!/usr/bin/ruby
# Github-flavored markdown to HTML, in a command-line util.
#
# $ cat README.md | ./ghmarkdown.rb
#
# Notes:
#
# You will need to install Pygments for syntax coloring
#
# $ pip install pygments
@schinckel
schinckel / selectable.js
Created April 2, 2013 11:39
Knockout extension: selectable observableArray
/*
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 / LICENSE
Last active December 13, 2015 22:30
Copyright (c) 2012, Matthew Schinckel.
All rights reserved.
Based on an algorithm at http://jsres.blogspot.com.au/2008/01/convert-hsv-to-rgb-equivalent.html
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
@schinckel
schinckel / increment_tcx_dates.py
Created May 22, 2012 12:37
Increment all of the dates within a TCX file by a certain amount.
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
@schinckel
schinckel / test_ouput
Created March 21, 2012 01:08 — forked from chronossc/test_ouput
Tests with models.
(github_projects_2)felipe@felipe-G51JX:~/projects/github_projects_2/clones/django-object-config/sample_project$ m test object_config --failfast --noinput
Creating test database for alias 'default'...
E
======================================================================
ERROR: test_option_create_many (object_config.tests.OptionsTest)
Test many items creation
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/felipe/projects/github_projects_2/clones/django-object-config/sample_project/object_config/tests.py", line 27, in setUp
self.model = MyModel.objects.create(name='test 1')