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 | |
# | |
# Mixpanel, Inc. -- http://mixpanel.com/ | |
# | |
# Python API client library to consume mixpanel.com analytics data. | |
# | |
# Copyright 2010-2013 Mixpanel, Inc | |
# Copyright 2016 Edadeal, LCC | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); |
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
# nlsio.py | |
# This module provide common routines in order to share solutions of NLSe. | |
# (c) Daniel Bershatsky, 2016 | |
# See LICENSE for details | |
from __future__ import absolute_import, print_function | |
from datetime import datetime | |
from scipy.io import savemat, loadmat | |
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 operator import itemgetter | |
from collections import OrderedDict | |
def word2index(model): | |
"""Extract word2index mapping from Word2Vec model. | |
""" | |
word2index = OrderedDict((v, k) for k, v in sorted(model.index2word, key=itemgetter(1))) | |
return word2index |
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 density_plot(subplot_number, value, label, name, labels): | |
extent = (gx[0, 0], gx[-1, -1], gy[0, 0], gy[-1, -1]) | |
ax = fig.add_subplot(120 + subplot_number, aspect='equal') | |
ax.set_xlabel(labels[0]) | |
ax.set_ylabel(labels[1]) | |
ax.set_title(name) | |
ax.imshow(value[0], extent=extent) | |
ax.contour(gx, gy, value[1].real, [0.0], colors='red', extent=extent) | |
ax.contour(gx, gy, value[1].imag, [0.0], colors='blue', extent=extent) |
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
# vortex_detection.py | |
# (c) Daniel Bershatsky, 2016 | |
# See LICENSE for details. | |
from __future__ import absolute_import, division | |
import skimage.measure as measure | |
import numpy as np | |
def fit_segment(contour, index): |
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 python3 | |
# frozen-lake.py | |
"""FrozenLake игрушечная задача для обучения с подкреплением. | |
""" | |
import click | |
import gym | |
import gym.wrappers.monitoring | |
import logging | |
import numpy as np |
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
#!/bin/bash | |
# inject-metrica.sh | |
# Inject Yandex Metrica counter into all HTML files after <body> tag. | |
COUNTER='<put Yandex Metrica one-line counter here>' | |
COUNTER=$(sed 's/\//\\\//g' <<< $COUNTER) | |
for file in $(ls *.html); do | |
echo "processing $file" | |
sed -i "s/<body>/<body>\n$COUNTER/g" $file |
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
// listen.c | |
// | |
// This is small tool that helps to clarify how to listen IPv6 socket and it | |
// is nessesary or not listen IPv4 socket at the same time. | |
// | |
// Compile `gcc -std=c11 -o listen listen.c` | |
// | |
// Run binary with option `-4` or `-6` and connect to port(default is 5489) | |
// with netcat in the following way. | |
// 1. `nc -4 127.0.0.1 5489` |
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
package main | |
import ( | |
"flag" | |
"io" | |
"log" | |
"os" | |
jpg "image/jpeg" | |
"image/png" |
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 python3 | |
import click | |
import PIL.Image | |
@click.command() | |
@click.argument('input', type=click.Path(exists=True, dir_okay=False)) | |
@click.argument('output', type=click.Path(exists=False)) | |
def main(input, output): | |
img = PIL.Image.open(input) |
OlderNewer