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 bash | |
# Author: Sasha Nikiforov | |
# source of inspiration | |
# https://stackoverflow.com/questions/41293077/how-to-compile-tensorflow-with-sse4-2-and-avx-instructions | |
# Detect platform | |
if [ "$(uname)" == "Darwin" ]; then | |
# MacOS |
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
difference(newObject: any, baseObject: any) { | |
function changes(newObject: any, baseObject: any) { | |
return _.transform(newObject, function(result, value, key) { | |
if (!_.isEqual(value, baseObject[key])) { | |
result[key] = (_.isObject(value) && _.isObject(baseObject[key])) ? changes(value, baseObject[key]) : value; | |
} | |
}); | |
} | |
const rval = changes(newObject, baseObject); |
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
function getRsaFromPubKey(pubKeyB64: string): RSAKey { | |
const pubKeyDecoded = b64tohex(pubKeyB64); | |
// jsrsasign cannot build key out of PEM or ASN.1 string, so we have to extract modulus and exponent | |
// you can get some idea what happens from the link below (keep in mind that in JS every char is 2 bytes) | |
// https://crypto.stackexchange.com/questions/18031/how-to-find-modulus-from-a-rsa-public-key/18034#18034 | |
const modulus = pubKeyDecoded.substr(50, 128); | |
const exp = pubKeyDecoded.substr(182, pubKeyDecoded.length); | |
return KEYUTIL.getKey({n: modulus, e: exp}); |
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 | |
# Sasha Nikiforov | |
import numpy as np | |
import numpy.linalg as lg | |
from functools import reduce | |
# Not super optimal way to calculate N-th Fibonacci - taken | |
# from stackoverflow |
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
S_{N} = S_{N-2} + S_{N-1} | |
A = \left[\begin{array}{cc} 0 & 1\\ 1 & 1 \end{array}\right] | |
A \left[\begin{array}{cc} S_{N-2} \\S_{N-1} \end{array}\right] = | |
\left[\begin{array}{cc} 0 & 1\\ 1 & 1 \end{array}\right] \left[\begin{array}{cc} S_{N-2} \\S_{N-1} \end{array}\right] = | |
\left[\begin{array}{cc} S_{N-1} \\ S_{N} \end{array}\right] | |
\left[\begin{array}{cc} 0 & 1\\ 1 & 1 \end{array}\right] \left[\begin{array}{cc} 0 & 1\\ 1 & 1 \end{array}\right] \left[\begin{array}{cc} S_{0} \\S_{1} \end{array}\right] = |
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
#!/bin/env python3 | |
from scipy.ndimage.io import imread | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import matplotlib.cm as cm | |
# Load the picture | |
img = imread('./lenin.jpg', flatten=True, mode=None) | |
# decompose the picture matrix |
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 python2 | |
# -*- coding: utf-8 -*- | |
import sys | |
import time | |
from datetime import datetime | |
keyString = u'купить' | |
goodString = u'купюра' | |
timeThreshold = 90 # seconds timescale |
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 numpy.linalg as linalg | |
import matplotlib.pyplot as plt | |
corpus = [] | |
corpus.append('I like deep learning') | |
corpus.append('I like NLP') | |
corpus.append('I enjoy flying') | |
word_index = {} |
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
x = rbind(mvrnorm(50, rep(0,10), diag(10)), mvrnorm(50, rep(c(1, 0), c(5, 5)), diag(10))) | |
y = rep(c(0, 1), c(50, 50)) | |
dat = data.frame(x, y=as.factor(y)) | |
svmfit = svm(y~., data=dat) | |
ex1 = function (times, svmfit) { | |
errate = rep(0, times) | |
test_size = 500 | |
for (i in 1:times) { |
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
<layout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools"> | |
<data> | |
<import type="android.view.View"/> | |
<variable | |
name="viewmodel" | |
type="com.example.gql1.viewmodels.PokemonVM"/> | |
</data> |
OlderNewer