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
;; -*- mode: emacs-lisp -*- | |
;; This file is loaded by Spacemacs at startup. | |
;; It must be stored in your home directory. | |
(defun dotspacemacs/layers () | |
"Configuration Layers declaration. | |
You should not put any user code in this function besides modifying the variable | |
values." | |
(setq-default | |
;; Base distribution to use. This is a layer contained in the directory |
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 collections import namedtuple | |
def value(*fields): | |
def wrapper(class_): | |
name = class_.__name__ | |
t = namedtuple(name, fields) | |
return type(name, (class_, t), {}) | |
return wrapper |
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
""" | |
PTB RNNLM model | |
according to tf: https://www.tensorflow.org/tutorials/recurrent#run_the_code | |
perplexity 120 is nice. 80 is great. | |
""" | |
from functools import partial | |
import torch | |
import torch.nn as nn |
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 scipy | |
from scipy import fftpack | |
from scipy import signal | |
from scipy.io import wavfile | |
import matplotlib.pyplot as plt | |
def add_eps(x): | |
x[scipy.where(x == 0)] = scipy.finfo(dtype=x.dtype).eps | |
return x |
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
#include <assert.h> | |
#include <thrust/host_vector.h> | |
#include <thrust/device_vector.h> | |
#include <algorithm> | |
#include <iostream> | |
#include <limits> | |
#include <cmath> | |
#include <utility> |
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
#include <assert.h> | |
#include <thrust/host_vector.h> | |
#include <thrust/device_vector.h> | |
#include <algorithm> | |
#include <iostream> | |
#include <limits> | |
#include <cmath> | |
#include <utility> |
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
/* library code */ | |
/++ | |
Referrence: | |
- https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm#Using_a_priority_queue | |
- http://shifth.hatenablog.com/entry/2015/05/31/104829 | |
+/ | |
auto dijkstra(alias distfun, E, V)(E[V[2]] tree, V start) { | |
import std.container : Array, PriorityQueue = BinaryHeap; |
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
/++ | |
This is a submodule of numir to provide formatting for ndslices. | |
Note: This relies on the formatting functionality from Phobos, the D standard | |
library. As of this writing, parts of it rely on the Garbage Collector and | |
potentially other non-Better C functionality in D. | |
+/ | |
module numir.format; | |
import mir.ndslice : SliceKind, Slice; | |
import std.traits : isSomeChar, isSomeString; |
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
(setq org-latex-classes '(("ltjsarticle" | |
"\\documentclass{ltjsarticle} | |
\\usepackage{url} | |
\\usepackage{amsmath} | |
\\usepackage{newtxtext,newtxmath} | |
\\usepackage{graphicx} | |
\\usepackage{luatexja} | |
\\usepackage{hyperref} | |
[NO-DEFAULT-PACKAGES] | |
[PACKAGES] |
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
#include <algorithm> | |
#include <functional> | |
#include <iostream> | |
#include <fstream> | |
#include <unordered_map> | |
#include <vector> | |
// byte array | |
using Memory = std::vector<unsigned char>; | |
using Pointer = Memory::iterator; |