Skip to content

Instantly share code, notes, and snippets.

View gist:f885ddbd5b9d6134f9ae318ae9158459
import random
def bleed_multiplier(min_d, max_d, aps, chance, duration, trials=10000, ruthless=True, fossil=True, rys=True):
min_new = min_d
max_new = max_d
if rys:
min_new = int(0.7*min_d)
max_new = int(1.4*max_d)
totals = []
View gist:0974b637115faca9dd6877d1fb5cceab
[user]
name = Dan Garfield
email = dbgarf@gmail.com
[alias]
co = checkout
s = status
a = add
d = difftool
c = commit
View gist:10214ba5fb7e61688f4a
from django.views.generic import View
import json
class userView(View):
def get(self, request, user_id):
response_content = json.dumps({'message': 'user not updated'})
return http.HttpResponse(response_content, status=200, mimetype='application/json')
def post(self, request, user_id):
user = User.objects.get(id=user_id)
View vowel.py
# re is the python regular expression module. its very powerful and worth learning.
import re
# unittest is the built in testing module. good for simple use cases like this.
from unittest import TestCase, TestLoader, TestResult
# compiling the regex pattern ahead of time, which adds significant speed
vowel_pattern = re.compile(r'[AEIOUaeiou]')
def is_vowel(char):
# raising errors for invalid input is a good idea
You can’t perform that action at this time.