Skip to content

Instantly share code, notes, and snippets.

View artsobolev's full-sized avatar
👨‍🔬
Everybody stand back! I'm doing science

Artëm Sobolev artsobolev

👨‍🔬
Everybody stand back! I'm doing science
View GitHub Profile
(function(){
var _utils = { // String.prototype.utils
append : function(tail){
return this + tail;
}
},
utils = {}, // фронтэнд. на этот объект будут навешены геттеры.
// на _utils геттеры вешать нельзя т.к. тогда мы не сможем (вроде как) добраться до методов
self = null, // тут будет контекст
generateGetter = function(fnc){ // это геттер
#ifndef MEMOIZATOR
#define MEMOIZATOR
#include <tuple>
#include <map>
template<class R, class... Args>
class Memoizator {
typedef std::tuple<Args...> tuple;
public:
#ifndef MEMOIZATOR
#define MEMOIZATOR
#include <tuple>
#include <map>
template<class R, class... Args>
class Memoizator {
typedef std::tuple<Args...> tuple;
typedef std::map<tuple, R> map;
@artsobolev
artsobolev / main.cpp
Created March 29, 2013 21:20
Crazy expressions parser
#include <iostream>
#include <string>
#include <vector>
class Token {
typedef std::vector<std::string> TokenList;
TokenList _tokens;
public:
Token(std::string t) {
@artsobolev
artsobolev / nsProto.js
Last active December 17, 2015 11:09
Namespaced Methods for [built-in types] in JavaScript
function extendPrototype(Class, name, obj) {
var nsProto = {},
self = null;
for (var prop in obj) {
if(!obj.hasOwnProperty(prop)) continue;
Object.defineProperty(nsProto, prop, {
enumerable: true,
configurable: false,
@artsobolev
artsobolev / main.cpp
Last active December 20, 2015 23:49
Circle map bifurcation generator
#include <cv.h>
#include <highgui.h>
#include <cmath>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <algorithm>
var revealJS = function(s) {
var hexAlphabet = Array.apply(null, {
length: 10
}).map(Number.call, Number).concat('abcdef'.split(''));
var codes = [8289, 8204, 8205, 8206, 8207, 8234, 8235, 8236, 8237, 8238, 8298, 8299, 8300, 8301, 8302, 8303];
return s.match(/(.{4})/g).map(function(b) {
return b.split('').map(function(i) {
return hexAlphabet[codes.indexOf(i.charCodeAt())]
})
@artsobolev
artsobolev / VAE MNIST.ipynb
Created November 25, 2015 12:16
Variational Autoencoder on MNIST
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
[["Stanford University","Stanford University","","Stanford University"],["Xi'an Jiaotong University","Xi'an Jiaotong University","",""],["Data61 and ANU","","Data61"],["UIUC","UIUC","UIUC"],["Data61 and ANU"],["Weizmann Institute of Science"],["ETH Zurich","ETH Zurich","ETH Zurich",""],["Google","","University of Washington"],[""],["","MIT","","",""],["","MIT","MIT",""],["",""],["University of South Carolina","University of South Carolina","University of South Carolina","University of South Carolina"],["HKUST","",""],["National Univ of Singapore","Sun Yat-sen University","National University of Singapo","NUS","National Univ of Singapore",""],["Tsinghua University","Tsinghua University","Tsinghua University",""],[""],["UC Berkeley","UC Berkeley","UC Berkeley","UC Berkeley"],["Columbia University","","",""],["UCLA","Adobe Research","","Adobe Research","",""],["Gatsby Unit","","Gatsby Unit",""],["","LAAS-CNRS"],["","Technion"],["Tel-Aviv University",""],["University of Michigan","Max Planck Institute for Informa
import time
import requests
import json
last_call = 0
def vk_query(method, **kwargs):
global last_call
ct = time.time()
if ct - last_call < 0.34:
time.sleep(0.34 - ct + last_call)