I hereby claim:
- I am mazieres on github.
- I am mazieres (https://keybase.io/mazieres) on keybase.
- I have a public key ASDzCRM2QkTnZ8Im0Yw210zPZZ54GykPj9xwJ6gw6bki0Qo
To claim this, I am signing this object:
| def flatten(li): | |
| return [item for sublist in li for item in sublist] |
| import progressbar | |
| i = 0 | |
| with progressbar.ProgressBar(max_value=len(entities)) as bar: | |
| for entity in entities: | |
| compute_metrics(entity) | |
| i += 1 | |
| bar.update(i) |
I hereby claim:
To claim this, I am signing this object:
| import json | |
| from json.decoder import WHITESPACE | |
| def iterload(string, cls=json.JSONDecoder, **kwargs): | |
| decoder = cls(**kwargs) | |
| idx = WHITESPACE.match(string, 0).end() | |
| while idx < len(string): | |
| try: | |
| obj, end = decoder.raw_decode(string, idx) | |
| idx = WHITESPACE.match(string, end).end() |
| function mkAllQueries(query) { | |
| var allRes = {} | |
| var promises = [] | |
| for (var i = 0; i < nb_hls; i++){ | |
| promises.push($.getJSON(apiUrl, { | |
| "client": "firefox", | |
| "hl": hls[i], | |
| "q": query | |
| }) | |
| .done(function (hl, q) { |
| package main | |
| import ( | |
| "bufio" | |
| "encoding/csv" | |
| "errors" | |
| "fmt" | |
| "io" | |
| "log" | |
| "os" |
| # dict of conversion of google's charset to python codec name | |
| enc_google_to_python = { | |
| "windows-1257": "cp1257", | |
| "GB2312 ": "gb2312", | |
| "windows-874": "cp874", | |
| "EUC-KR": "euc_kr", | |
| "Shift_JIS": "shift_jis", | |
| "UTF-8": "utf_8", | |
| "ISO-8859-2": "iso8859_2", | |
| "ISO-8859-9": "iso8859_9", |
| import re | |
| def get_imports(script): | |
| res = [] | |
| patt = re.compile('^(?:import|from).*$', re.MULTILINE) | |
| raw_imports = re.findall(patt, script) | |
| if raw_imports == []: | |
| return None | |
| for imp in raw_imports: | |
| if '#' in imp: |
| #!/usr/bin/env python | |
| # by @mazieres | |
| from itertools import permutations | |
| from collections import defaultdict | |
| import pandas as pd | |
| import numpy as np | |
| from matplotlib import pyplot as plt | |
| min_freq = 1 | |
| min_weight = 3 | |
| min_degree = 2 | |
| G.remove_edges_from([(u, v, d) for u, v, d in G.edges(data=True) | |
| if d['weight'] <= min_weight]) | |
| G.remove_nodes_from([n for n, d in G.nodes(data=True) | |
| if d['freq'] <= min_freq or | |
| len(G[n]) <= min_degree]) |