Skip to content

Instantly share code, notes, and snippets.

View audiodude's full-sized avatar

Travis Briggs audiodude

View GitHub Profile
float getDistance(Location l1, Location l2) {
short dx = abs(l1.x - l2.x), dy = abs(l1.y - l2.y);
if(dx > width / 2) dx = width - dx;
if(dy > height / 2) dy = height - dy;
return dx + dy;
}
remote: + selected_name=Multipack
remote: + [[ -n /tmp/buildpacks/00_buildpack-multi ]]
remote: + [[ -n Multipack ]]
remote: + title 'Multipack app detected'
----->' Multipack app detected
-----> Multipack app detected == --* ]]
-----> Multipack app detected == ==* ]]
-----> Multipack app detected'
remote: + read line
remote: + cd /tmp/build
@audiodude
audiodude / example.com.conf
Created April 10, 2017 05:18
nginx configuration for Mastodon
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
listen [::]:80;
server_name example.com;
return 301 https://$host$request_uri;
class Foo(object):
bar = [1,2,3]
def __init__(self, idx):
self.idx = idx
def my_bar(self):
return self.bar[self.idx]
throw new Error('Ran out of phrases in ' + groups + ' while generating ' + this.__currentSnippet);
^
Error: Ran out of phrases in while generating sentence
at Improv.selectPhrase (/home/tmoney/code/nanogenmo2017/node_modules/improv/dist/index.js:164:15)
at Improv.__gen (/home/tmoney/code/nanogenmo2017/node_modules/improv/dist/index.js:83:31)
at processDirective (/home/tmoney/code/nanogenmo2017/node_modules/improv/dist/template.js:116:12)
at processDirective (/home/tmoney/code/nanogenmo2017/node_modules/improv/dist/template.js:77:47)
at template (/home/tmoney/code/nanogenmo2017/node_modules/improv/dist/template.js:151:24)
at Improv.__gen (/home/tmoney/code/nanogenmo2017/node_modules/improv/dist/index.js:93:48)
select rev_id
from enwiki_p.revision join enwiki_p.page
on page_namespace = ? and page_title = ?
and rev_page = page_id
where rev_timestamp <= ?
order by rev_timestamp desc limit 1'
@audiodude
audiodude / project_list_212
Last active February 27, 2019 05:04
First list is a list of WIkiProjects with between 13k and 50k articles. Second list is every 10th item from the first list.
Sweden 49334
Stations 49151
Ice_Hockey 48609
Visual_arts 47960
Road_transport 47654
History 47532
Computing 46912
Cricket 46564
Comics 45475
Medicine 44619

Implementatations of Regret Minimization and Counterfactual Regret Minimization in Python.

These are implemented as outlined in An Introduction to Counterfactual Regret Minimization (Neller and Lanctot) (paper here)

rps.py: finds a correlated equilibrium in Rocks-Paper-Scissors, which in this case happens to be the Nash equilibrium. It is very similar to the code found in this YouTube video

kuhn.py: finds a correlated equilibrium in Kuhn Poker which is a toy poker game described in the paper and previously.

kuhn_3.py: finds a correlated equilibrium in 3 player Kuhn Poker, as described in this paper

@audiodude
audiodude / protected.txt
Created August 26, 2019 16:23
English Wikipedia WP 1.0 log pages that are still protected
https://en.wikipedia.org/wiki/Wikipedia:Version_1.0_Editorial_Team/Buckinghamshire_articles_by_quality_log
https://en.wikipedia.org/wiki/Wikipedia:Version_1.0_Editorial_Team/Buffyverse_articles_by_quality_log
https://en.wikipedia.org/wiki/Wikipedia:Version_1.0_Editorial_Team/Canada_Streets_articles_by_quality_log
https://en.wikipedia.org/wiki/Wikipedia:Version_1.0_Editorial_Team/Canada_road_transport_articles_by_quality_log
https://en.wikipedia.org/wiki/Wikipedia:Version_1.0_Editorial_Team/Canadian_cinema_articles_by_quality_log
https://en.wikipedia.org/wiki/Wikipedia:Version_1.0_Editorial_Team/Canadian_law_articles_by_quality_log
https://en.wikipedia.org/wiki/Wikipedia:Version_1.0_Editorial_Team/Canadian_military_history_articles_by_quality_log
https://en.wikipedia.org/wiki/Wikipedia:Version_1.0_Editorial_Team/Canadian_TV_shows_articles_by_quality_log
https://en.wikipedia.org/wiki/Wikipedia:Version_1.0_Editorial_Team/Canadian_communities_articles_by_quality_log
https://en.wikipedia.org/wiki/Wikipedia:Version
import xml.etree.ElementTree as Et
tree = Et.ElementTree(file = 'test.xml')
root = tree.getroot()
for child in root:
for grandchild in child:
print(grandchild.findall('.//Raw_Material'))