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
# install mkl | |
RUN apt update && apt install -y --force-yes apt-transport-https && \ | |
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB && \ | |
apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB && \ | |
sh -c 'echo deb https://apt.repos.intel.com/mkl all main > /etc/apt/sources.list.d/intel-mkl.list' && \ | |
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install cpio intel-mkl-64bit-2018.3-051 && \ | |
(find /opt/intel -name "ia32*" -exec rm -rf {} \; || echo "removing ia32 binaries") ; \ | |
(find /opt/intel -name "examples" -type d -exec rm -rf {} \; || echo "removing examples") ; \ | |
(find /opt/intel -name "benchmarks" -exec rm -rf {} \; || echo "removing benchmarks") ; \ | |
(find /opt/intel -name "documentation*" -exec rm -rf {} \; || echo "removing documentation") ; \ |
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
extern mod sync; | |
// str op trait | |
use std::str::StrSlice; | |
// for tcp listen | |
use std::io::{TcpListener, TcpStream}; | |
use std::io::net::ip::SocketAddr; | |
// for trait | |
use std::io::{Listener, Writer, Acceptor, Buffer}; | |
// for spawn |
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
""" | |
Hierarchial Clustering. | |
The goal of gist is to show to use scikit-learn to perform agglomerative clustering when: | |
1. There is a need for a custom distance metric (like levenshtein distance) | |
2. Use the distance in sklearn's API. | |
Adapted from: sklearn's FAQ. | |
http://scikit-learn.org/stable/faq.html | |
""" |
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 time | |
import numba | |
from numba import jit | |
import numpy as np | |
#input matrices | |
matrix1 = np.random.rand(30,30) | |
matrix2 = np.random.rand(30,30) | |
rmatrix = np.zeros(shape=(30,30)) |
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
from numba import cuda | |
gpus = cuda.gpus.lst | |
for gpu in gpus: | |
with gpu: | |
meminfo = cuda.current_context().get_memory_info() | |
print("%s, free: %s bytes, total, %s bytes" % (gpu, meminfo[0], meminfo[1])) |
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
:: Launch PyCharm from within conda environment | |
:: This will ensure that all necessary environment variables are set. | |
:: Modify the paths and environment name for your installation, if necessary. | |
:: This configuration is for PyCharm x64 installed with JetBrains Toolbox and | |
:: will launch the latest installed version. | |
@set condaroot="%userprofile%\Anaconda3" | |
@set pycharmroot="%localappdata%\JetBrains\Toolbox\apps\PyCharm-P\ch-0" | |
@set env=base |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
// Source : https://gist.github.com/Azerothian/dc84f009a94579b5bb43#gistcomment-2002977 | |
function isObject(avar) { | |
// cosntructor.name tested for `function Animal(){}; var a = new Animal(); isObject(a);` will return true otherwise as it is [Object object] | |
return Object.prototype.toString.call(avar) === '[object Object]' && avar.constructor.name === 'Object'; | |
} | |
function createGqlQuery(obj) { | |
let shape = []; | |
for (let [key, val] of Object.entries(obj)) | |
shape.push(isObject(val) ? `${key} { ${createGqlQuery(val)} }` : key); |
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
https://github.com/Microsoft/vscode/blob/c2d56115afa1647f204ec9afec3a078fc1dac67a/src/vs/workbench/api/electron-browser/mainThreadSaveParticipant.ts#L333 |
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
package com.stackoverflow.q3732109; | |
import java.io.IOException; | |
import java.io.OutputStream; | |
import java.net.InetSocketAddress; | |
import com.sun.net.httpserver.HttpExchange; | |
import com.sun.net.httpserver.HttpHandler; | |
import com.sun.net.httpserver.HttpServer; |