Skip to content

Instantly share code, notes, and snippets.

@waprin
waprin / gist:a5eae8a90c1847c6bdfad914a934e286
Created March 1, 2024 18:43
hacky live poker "spaced rep"
function shuffleArray(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]]; // swap elements
}
}
function getRandomQuestions(questions, num=20) {
Processed 387 Errors 11
Liquid won 258 of the games.
Found 47 out of 387 games where Liquid picked Io.
Io was banned in {} matches. 239
Wisp lost in 13 of the games.
------------Opponents---------------------
Hero Tiny has won 3 out of 3 games against Liquid IO for a win percent of 1.0 (matches [3796359654, 3796268587, 3766915400])
Hero Razor has won 1 out of 1 games against Liquid IO for a win percent of 1.0 (matches [3698342712])
Hero Brewmaster has won 1 out of 1 games against Liquid IO for a win percent of 1.0 (matches [3595326728])
Hero Leshrac has won 1 out of 1 games against Liquid IO for a win percent of 1.0 (matches [3595326728])
@waprin
waprin / analyze.py
Created August 13, 2018 16:32
analyze opponents
print('------------Opponents---------------------')
hero_wins = collections.defaultdict(int)
hero_totals = collections.defaultdict(int)
hero_matches = collections.defaultdict(list)
for match in wisp_matches:
for hero in match.opponent_picks:
hero_totals[hero] += 1
if not match.liquid_win:
hero_wins[hero] += 1
hero_matches[hero].append(match.match)
@waprin
waprin / analyze.py
Last active August 13, 2018 16:31
Create match class
class Match:
def __init__(self, match, liquid_win):
self.match = match
self.liquid_win=liquid_win
self.liquid_picks = []
self.liquid_bans = []
self.opponent_picks = []
self.opponent_bans = []
@waprin
waprin / analyze.py
Created August 13, 2018 16:28
High level stats
won_matches = list(filter(lambda m : m.liquid_win, processed_matches))
print('Liquid won {} of the games.'.format(len(won_matches)))
wisp_banned = list(filter(lambda m: 'Io'in m.opponent_bans, processed_matches))
wisp_matches = list(filter(lambda m: 'Io' in m.liquid_picks, processed_matches))
print('Found {} out of {} games where Liquid picked Io.'.format(len(wisp_matches), len(processed_matches)))
print('Io was banned in {} matches.', len(wisp_banned))
@waprin
waprin / analyze.py
Created August 12, 2018 23:27
process the liquid matches
class Match:
def __init__(self, match, liquid_win):
self.match = match
self.liquid_win=liquid_win
self.liquid_picks = []
self.liquid_bans = []
self.opponent_picks = []
self.opponent_bans = []
@waprin
waprin / load_matches.py
Created August 12, 2018 23:21
loading dota matches
import json
import time
import requests
input_file = open('liquid_matches.json')
matches = json.load(input_file)
input_file.close()
print('Loading {} matches\n'.format(len(matches)))
f = open('liquid_match_data.txt', 'w')
<section>
<section id="kubernetes-cli-basics-with-kubectl">
<h2>Google Container Engine (GKE) Basics</h2>
<p><a href="http://kubernetes.io/"><img src="https://pbs.twimg.com/profile_images/511909265720614913/21_d3cvM.png" alt="kubernetes" style='width:30%;'></a><br/>with <a href="https://kubernetes.io/docs/user-guide/kubectl/"><code>kubectl</code></a></p>
<h4 class='fragment grow'><a href="http://bit.ly/k8s-kubectl"><code>bit.ly/k8s-kubectl</code></a></h4>
</section>
<section id='presented-by' data-markdown>
presented by
[![CoreOS Logo](http://i.imgur.com/DRm4KEq.png "")](https://coreos.com)
@waprin
waprin / k8s-workshops.html
Last active May 23, 2017 22:19 — forked from ryanj/k8s-workshops.html
http://bit.ly/k8s-workshops: a modular workshop series for learning Kubernetes
<section>
<section id="a-modular-workshop-series-for-learning-kubernetes">
<h2><code>k8s-workshops</code></h2>
<p><a href="http://kubernetes.io/"><img src="https://pbs.twimg.com/profile_images/511909265720614913/21_d3cvM.png" alt="kubernetes" style='width:30%;'></a><br/>a modular workshop series for <a href="http://kubernetes.io/">Kubernetes</a></p>
<h3 class='fragment grow'><a href="http://bit.ly/k8s-workshops"><code>bit.ly/k8s-workshops</code></a></h3>
</section>
<section id='presented-by' data-markdown>
presented by
[![CoreOS Logo](http://i.imgur.com/DRm4KEq.png "")](https://coreos.com)
CACHES = {
‘default’: {
‘BACKEND’: ‘redis_cache.RedisCache’,
‘LOCATION’: [
‘%s:%s’ % (os.getenv(‘REDIS_MASTER_SERVICE_HOST’, ‘127.0.0.1’),