View optimal_strategy.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
https://brilliant.org/community-problem/loser-keeps-bieber-we-stood-no-chance/ | |
?group=4cgSapeNTVXO&ref_id=115277 | |
""" | |
import random | |
def play_defensive(them): | |
if random.random() <= 0.04: |
View gist:ea2ab1c62a547e381411
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OSX - 10.8.5 | |
❯ virtualenv-2.7 --version | |
1.11.5 | |
❯ ./jython/dist/bin/jython | |
Jython 2.7b2+ (default:f6f7196d27a5, May 15 2014, 20:10:22) | |
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0_55 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> |
View gist:291188
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2010-01-31 12:58:37-0600 [-] Unhandled Error | |
Traceback (most recent call last): | |
File "/home/skyl/envs-projs/hotdot_env/lib/python2.5/site-packages/twisted/application/app.py", line 445, in startReactor | |
self.config, oldstdout, oldstderr, self.profiler, reactor) | |
File "/home/skyl/envs-projs/hotdot_env/lib/python2.5/site-packages/twisted/application/app.py", line 348, in runReactorWithLogging | |
reactor.run() | |
File "/home/skyl/envs-projs/hotdot_env/lib/python2.5/site-packages/twisted/internet/base.py", line 1166, in run | |
self.mainLoop() | |
File "/home/skyl/envs-projs/hotdot_env/lib/python2.5/site-packages/twisted/internet/base.py", line 1175, in mainLoop | |
self.runUntilCurrent() |
View gist:296994
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(mednet)skyl@SCSI40:~/Code/python$ pip install -e svn+http://code.djangoproject.com/svn/django/trunk/#egg=django | |
Obtaining django from svn+http://code.djangoproject.com/svn/django/trunk/#egg=django | |
Could not find setup.py for directory /home/skyl/Code/python/envs/mednet/src/django (tried all parent directories) | |
Exception: | |
Traceback (most recent call last): | |
File "/home/skyl/Code/python/envs/mednet/lib/python2.6/site-packages/pip-0.6.1-py2.6.egg/pip.py", line 482, in main | |
self.run(options, args) | |
File "/home/skyl/Code/python/envs/mednet/lib/python2.6/site-packages/pip-0.6.1-py2.6.egg/pip.py", line 675, in run | |
requirement_set.install_files(finder, force_root_egg_info=self.bundle) | |
File "/home/skyl/Code/python/envs/mednet/lib/python2.6/site-packages/pip-0.6.1-py2.6.egg/pip.py", line 2409, in install_files |
View gist:297913
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
keys: | |
::site-wide keys:: | |
'users' | |
The set of usernames. | |
r.sismember('users', 'foouser') | |
'groups' | |
List of all groups | |
'groups_incr' |
View djredis_iface.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from djredis.models import DredisMixin | |
import djredis.models | |
class Blog(models.Model, DredisMixin): # inherit from the mixin class | |
author = models.ForeignKey('Author') | |
title = models.CharField(max_length=200) | |
# declaratively add your redis fields | |
viewcount = djredis.models.Counter() |
View gist:423540
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from mymongo.models import Mongo | |
class M(models.Model): | |
... | |
mongo = Mongo() | |
View Tomjunk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8"/> | |
<title> | |
Google Visualization API Sample | |
</title> | |
<script type="text/javascript" src="http://www.google.com/jsapi"></script> | |
<script type="text/javascript"> |
View gist:753900
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django import db | |
from django.db import connection | |
from django.conf import settings | |
class LoggingMiddleware(object): | |
def process_request(self, request): | |
"""Logs the POST (and resets the queries if DEBUG)""" |
View gist:764182
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
v1 = Stepper( | |
[60,30,30,30,50,N] * 2 + [120,40,40,120,40,40] * 2 | |
) | |
n1 = snd(cycle( | |
[R(60,48)] | |
)) | |
d1 = rhodes_f() | |
player1 = Player(d1, n1, v1, interval=sixteenth) | |
player1.startPlaying() |
OlderNewer