This file contains hidden or 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
>>> words = "L’organisme ou la forme peut etre desintegres sin on en fait un emploi occulte".split() | |
>>> words | |
['L’organisme', 'ou', 'la', 'forme', 'peut', 'etre', 'desintegres', 'sin', 'on', 'en', 'fait', 'un', 'emploi', 'occulte'] | |
>>> n_words = len(words) | |
>>> left = words[:n_words//2] | |
>>> left | |
['L’organisme', 'ou', 'la', 'forme', 'peut', 'etre', 'desintegres'] | |
>>> right = words[n_words//2:] | |
>>> right | |
['sin', 'on', 'en', 'fait', 'un', 'emploi', 'occulte'] |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<!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" lang="en" xml:lang="en"> | |
<head> | |
<title>iclr_data</title> | |
<!-- 2018-02-08 Thu 15:54 --> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> | |
<meta name="generator" content="Org-mode" /> | |
<meta name="author" content="Christian Jauvin" /> |
This file contains hidden or 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 datetime as dt | |
import json | |
import os | |
N_PER_BOX = 30 | |
path = os.path.dirname(os.path.realpath(__file__)) |
This file contains hidden or 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 intersect(cur, sn1, sn2, sdr, inter_table): | |
sn1_field = STREETNAME_FIELD | |
if isinstance(sn1, int): | |
sn1_field = 'norte' | |
sn2_field = STREETNAME_FIELD | |
if isinstance(sn2, int): | |
sn2_field = 'norte' | |
q = """ |
{0,1,2,3} {} {} | |||
{0,1,2} {} {} | |||
{0,1} {} {} | |||
{0,1,2,3} {} {} -> {1,2,3} {0} {} | |||
{0} {} {} -> {} {0} {} | |||
---|---|---|---|
This file contains hidden or 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 collections import Counter, defaultdict | |
import numpy as np | |
N = 45 | |
K = 1350 | |
#K = 10 | |
goal = (31, 39) # (7, 4) | |
#goal = (7, 4) | |
G = np.zeros((N, N)) # [y][x] |
This file contains hidden or 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 collections import defaultdict | |
import re | |
bot_values = defaultdict(list) # bot i -> list of values | |
bins = {} | |
s = """value 5 goes to bot 2 | |
bot 2 gives low to bot 1 and high to bot 0 | |
value 3 goes to bot 1 |
This file contains hidden or 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 sys | |
import re | |
def decompress(s): | |
d = [] | |
while True: | |
m = re.search('(\((\d+)x(\d+)\)).*', s) | |
if m: | |
n_chars, mult = map(int, m.groups()[1:]) |
This file contains hidden or 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 numpy as np | |
import re | |
def rect(a, b): | |
g[:b, :a] = 1 | |
def rotate_row(a, b): | |
g[a, :] = np.append(g[a, -b:], g[a, :-b]) |