Skip to content

Instantly share code, notes, and snippets.

View georgedorn's full-sized avatar
💭
mostly moved to gitlab

Sam Thompson georgedorn

💭
mostly moved to gitlab
View GitHub Profile
index 146ac15..647a826 100644
--- a/tests/core/tests/resources.py
+++ b/tests/core/tests/resources.py
@@ -1404,6 +1404,24 @@ class ModelResourceTestCase(TestCase):
self.assertTrue("resource_uri" in data)
self.assertTrue("title" in data)
self.assertTrue("is_active" in data)
+
+ def test_post_list_duplicate(self):
+ self.assertEqual(Note.objects.count(), 6)
@georgedorn
georgedorn / snatchdj.js
Created September 25, 2011 05:09
Fast grab of DJ slot on Turntable.fm
var is_dj = false;
var timeout_handler = 0;
function get_slot(){
if(is_dj){
if (timeout_handler){
clearInterval(timeout_handler);
}
return;
}
@georgedorn
georgedorn / gist:1240964
Created September 25, 2011 18:59
UpdateView that handles "create" as well
from myapp.models import MyModel, RelatedModel
from django.views.generic import UpdateView
class ModelCreateUpdateView(UpdateView):
model = MyModel
def get_object(self, *args, **kwargs):
related_id = self.kwargs.get('related_id')
related_model = RelatedModel.objects.get(pk=related_id)
@georgedorn
georgedorn / autodj.bookmarklet.js
Created September 26, 2011 23:22 — forked from mattsgarrison/autodj.bookmarklet.js
Turntable.fm DJ Script
javascript:(function(g,d,f){if(f)d.info("Session found:",f);else return d.warn("No session found!");var h={check:10,wait:500},b=g.autodj={api:g[f],available:function(a){return b.api.taken_dj_map[a]<0},spot:function(){return b.api.become_dj.data("spot")},become:function(a){b.api.callback("become_dj",a)},waiter:function(a){return function(){return b.available(a)?(b.become(a),a):(-1)}},seated:function(a){return b.api.djs[a]&&b.api.djs[a][0]===b.api.myuserid},wait:function(a,c){var e=c!==void 0,
a=a||h.check,c=c||b.spot();b.seated(c)?d.warn("Spot",c,"taken!"):(e&&d.error("Spot",c,"missed. Restarting..."),d.info("Polling @",a,"ms"),b.check(a,b.waiter(c)))},check:function(a,c){setTimeout(function(){var e=c.call(b);e>0?(d.warn("Spot",e,"open..."),setTimeout(function(){b.wait(a,e)},h.wait)):b.check(a,c)},a)}}})(window,console,function(g,d,f,h,b,a,c,e,i,j,k){try{return g(d)[f](h)[b][a][c][e]()[i](j)[k]}catch(l){return null}}(jQuery,".invite_dj","data","events","click",0,"handler","toString","match",
/\{\s*(.+)\./,1));
@georgedorn
georgedorn / stat_analysis.py
Created November 28, 2012 22:37
Analysis of Random vs Point-Buy for Rolemaster Playtest
"""
Rolls up a huge number of rolemaster characters,
calculates the equivalent values using point-buy,
aggregates the results.
"""
number_of_rolls_per_stat = 3
minimum_stat_roll = 11
number_of_characters = 100000 #pretty consistant at this number, use more if you feel like it
import json
from collections import OrderedDict
from tastypie.serializers import Serializer
from tastypie import fields
from tastypie.resources import Resource
from django.core.serializers.json import DjangoJSONEncoder
class OrderedSerializer(Serializer):
def to_json(self, data, options=None):
options = options or {}
@georgedorn
georgedorn / get_event_types.py
Last active October 19, 2016 18:00
Parses a python codebase to find all event_types along with event_name subtypes where appropriate.
import json
import random
import re
import sys
from pprint import pprint
from subprocess import check_output
from collections import defaultdict
@georgedorn
georgedorn / opencv_OSX.sh
Created October 31, 2016 14:56 — forked from chintak/opencv_OSX.sh
OpenCV with a Virtualenv
# Installing OpenCV python libs on mac to work with virtualenv
# OpenCV 2.4.3
# Python 2.7.3 installed with brew
# assuming you have virtualenv, pip, and python installed via brew
# assuming $WORKON_HOME is set to something like ~/.virtualenvs
# using homebrew - make sure we're current
brew update
@georgedorn
georgedorn / therm.py
Created August 23, 2017 01:49 — forked from ghostbitmeta/therm.py
Python script to control Honeywell Thermostat's through My Total Connect
#!/usr/bin/python
# By Brad Goodman
# http://www.bradgoodman.com/
# brad@bradgoodman.com
####################### Fill in settings below #######################
USERNAME="your@emailaddress.com"
PASSWORD="your_total_comfort_password"
@georgedorn
georgedorn / Steam_Proton_Exe.md
Last active October 19, 2021 23:05 — forked from michaelbutler/Steam_Proton_Exe.md
How to run Timberborn on Linux Proton, in a borderless window (probably works for other games)

Timberborn runs fine on Proton, with the one exception that alt-tab causes the game to stop updating the screen. It keeps running (and you can click on stuff) but you're left with either a black window or a frozen window.

You can run the game in a window to prevent this from happening, but then you can't use your full resolution (or have to accept not seeing the bottom of the screen). On some Linux WMs, you can just tell it to run full-screen anyway while the game thinks it is in windowed mode, but on most compositing WMs this doesn't work.

On Windows, there's an open source app called Borderless Gaming to resolve this problem. It is for sale on Steam, though I have no idea if it can be made to run on Proton in combination with another game, given that they don't share the same Wine prefix. However, you can download it for free from the releases page here: https://github.com/Codeusa/Borderless-Gaming/releases/tag/9.5.6

To get Borderless Gaming working on Proton:

# Step 1: install Borderless Gami