Skip to content

Instantly share code, notes, and snippets.

View nvbn's full-sized avatar

Vladimir Iakovlev nvbn

View GitHub Profile
@nvbn
nvbn / find.py
Created July 9, 2018 22:23
trip planner
import json
from datetime import date, datetime, timedelta
from collections import defaultdict, namedtuple
from multiprocessing import Pool, cpu_count
import csv
from operator import itemgetter
from heapq import merge
from itertools import islice
from dateutil.parser import parse
@nvbn
nvbn / fimstrip.py
Last active June 20, 2018 07:14
fimstrip.py
from collections import Counter
import requests
from pycaption.srt import SRTReader
import lxml.html
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
from nltk.stem import WordNetLemmatizer
lang = 'en-US'
path = ''
import json
from datetime import datetime
from collections import namedtuple
from itertools import groupby, takewhile
from statistics import median, mean
from matplotlib import pyplot
import numpy as np
from geopy.distance import geodesic
Point = namedtuple('Point', 'latitude, longitude, datetime')
@nvbn
nvbn / wrapper.go
Created February 25, 2018 09:23
Low-level shell wrapper package
package wrapper
import (
"os/exec"
"os"
"sync"
"github.com/kr/pty"
"github.com/creack/termios/raw"
"github.com/creack/termios/win"
"io"
const { app, BrowserWindow, TouchBar } = require('electron');
const { TouchBarLabel, TouchBarButton } = TouchBar;
const count = 8;
const interval = 500;
const colors = [
'#ff0000',
'#00ff00',
'#0000ff',
'#ffff00',
// android/app/src/main/java/com/YOUR_APP/webview/WebViewWrapperManager.java
package com.YOUR_APP.webview;
import android.webkit.WebView;
import com.facebook.react.views.webview.ReactWebViewManager;
import com.facebook.react.uimanager.ThemedReactContext;
public class WebViewWrapperManager extends ReactWebViewManager {
private static final String REACT_CLASS = "RCTWebViewWrapper";
@nvbn
nvbn / main.py
Last active December 5, 2017 07:48
flights graph
from collections import Counter
import tweepy
import networkx
from matplotlib import cm, pyplot
TWITTER_CONSUMER_KEY = ''
TWITTER_CONSUMER_SECRET = ''
TWITTER_ACCESS_TOKEN = ''
TWITTER_ACCESS_TOKEN_SECRET = ''
from abc import ABC, abstractmethod
from typing import List, NamedTuple, Iterable, Any, TypeVar, Generic, Callable
import matplotlib.pyplot as plt
from line_profiler import LineProfiler
ComplexityLogEntry = NamedTuple('ComplexityLogEntry', [('size', int),
('hits', int)])
class BaseComplexityAssumption(ABC):
@nvbn
nvbn / out.py
Last active May 1, 2017 18:58
py-backwards result
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
def _py_backwards_merge_dicts(dicts):
result = {}
for dict_ in dicts:
result.update(dict_)
@nvbn
nvbn / validator.cpp
Created April 5, 2017 13:11
validator
#include <iostream>
#include <sstream>
#include <regex>
using namespace std;
class Validator {
public:
Validator(istream &in) : in_(in) {}