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 pyramid.paster import bootstrap | |
env = bootstrap('moatbot_experiment.ini') | |
from datetime import datetime, timedelta | |
from scrapepipeline import US_DESKTOP_REGION, UK_DESKTOP_REGION | |
from scrapepipeline.potato2.client import GlobalEntity, TagGroup, Tag | |
from scrapepipeline.cache import ghostery | |
from itertools import chain, product |
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 pyramid.paster import bootstrap | |
env = bootstrap('moatbot_experiment.ini') | |
from datetime import datetime, timedelta | |
from scrapepipeline import US_DESKTOP_REGION, UK_DESKTOP_REGION | |
from scrapepipeline.potato2.client import GlobalEntity, TagGroup, Tag | |
from scrapepipeline.cache import ghostery | |
from itertools import chain, product |
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
#!/usr/bin/env python | |
import logging | |
import os | |
import random | |
import re | |
import simplejson as json | |
import string | |
import subprocess | |
import sys |
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
{"cache": {"start": [2014, 2, 12, 0, 0, 0], "end": [2014, 2, 13, 0, 0, 0], "type": "archive"}, "run": {"when": [2014, 3, 17, 15, 28, 32]}} | |
{"assets": [], "doc": {"ads": [], "url": "http://usda.gov/wps/portal/usda/usdahome", "pos": [0, 0], "botId": 0, "dims": [1585, 1251], "pixels": [], "scripts": [], "url_id": null, "type": "doc", "why": {}}, "_rev": "1-abd4a791ab4c8ad24f5fa596066778de", "tree": {"children": [{"children": [], "context": {"ads": [], "botId": 1, "pos": [0, 0], "dims": [0, 0], "pixels": [], "scripts": [{"visible": false, "url": "http://www.google-analytics.com/plugins/ga/inpage_linkid.js", "id": "undefined", "pos": [0, 0], "botId": 351, "dims": [0, 0], "initiators": ["http://usda.gov/wps/portal/usda/usdahome", "http://usda.gov/documents/usda30/js/federated-analytics.js", "http://www.google-analytics.com/ga.js"], "elementType": "script", "type": "js", "why": {}}, {"visible": false, "url": "http://www.google-analytics.com/ga.js", "pos": [0, 0], "botId": 352, "dims": [0, 0], "parents": ["http://usd |
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
def fact(x): | |
if x == 0: | |
return 1 | |
else | |
return x*fact(x-1) |
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
pathRecurse :: Board -> [Pos] -> Pos -> Pos -> Maybe [Pos] | |
pathRecurse b visited pa pb | |
| pa == pb = Just (visited++[pb]) | |
| null neighbors = Nothing | |
| null subpaths = Nothing | |
| otherwise = Just ( minimumBy (comparePath) subpaths ) | |
where subpaths = catMaybes ( map (\n -> pathRecurse b (visited++[pa]) n pb) neighbors) | |
neighbors = filter (\x -> (walkable b x) && not (x `elem` visited)) (getNeighbors b pa) | |
comparePath x y = compare (length x) (length y) |
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
import argparse | |
import hashlib | |
from videoads import VideoCreative | |
def main(path): | |
new_path = '{0}-converted'.format(path) | |
VideoCreative.convert(path, new_path) | |
phash_key = '1-md5-%s' % hashlib.md5(unicode(VideoCreative.video_phash(new_path, 2))).hexdigest() | |
print phash_key |
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
const std = @import("std"); | |
const Allocator = std.mem.Allocator; | |
/// A "IdioticAllocator." An idiotic allocator that does not free, ignores | |
/// alignment and simply returns an offset into a static buffer. Not useful | |
/// for anything but a learning tool. | |
pub fn IdioticAllocator(comptime bufferSize: usize) type { | |
return struct { | |
const Self = @This(); |
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
const zalloc = @import("zalloc/index.zig"); | |
const std = @import("std"); | |
const debug = std.debug; | |
const Allocator = std.mem.Allocator; | |
test "test idiotic alloc low value" { | |
var allocator: Allocator = zalloc.IdioticAllocator(200).init().allocator; | |
var slice = try allocator.alloc(*i32, 100); |
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
import pygame, sys | |
WHITE = (255, 255, 255) | |
BLUE = (255, 0, 0) | |
# set up pygame | |
pygame.init() | |
# set up the window | |
windowSurface = pygame.display.set_mode((500, 400), 0, 32) |
OlderNewer