- node.js
- Installation paths: use one of these techniques to install node and npm without having to sudo.
- Node.js HOWTO: Install Node+NPM as user (not root) under Unix OSes
- Felix's Node.js Guide
- Creating a REST API using Node.js, Express, and MongoDB
- Node Cellar Sample Application with Backbone.js, Twitter Bootstrap, Node.js, Express, and MongoDB
- JavaScript Event Loop
- Node.js for PHP programmers
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 torch | |
from torch import nn | |
from torch.autograd import Variable | |
import torch.nn.functional as F | |
class RNN(nn.Module): | |
def __init__(self, input_size, hidden_size, output_size, n_layers=1): | |
super(RNN, self).__init__() | |
self.input_size = input_size | |
self.hidden_size = hidden_size |
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
// @brief Created on top of std::chrono::system_clock, | |
// MicroSecResolutionClock offers a clock with microseconds duration. | |
struct MicroSecResolutionClock : public std::chrono::system_clock { | |
typedef std::chrono::microseconds duration; | |
typedef duration::rep rep; | |
typedef duration::period period; | |
typedef std::chrono::time_point<MicroSecResolutionClock, duration> time_point; | |
static const bool is_steady = false; | |
static const int ticks_per_time_t = period::den; |
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/bash | |
# Makefile for RandomLibrary | |
CC = ~/clang-3.8.0/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04/bin/clang++ | |
DEBUG = -g | |
AUXLIBS = | |
AUXINCLUDES = | |
LOCALDEPSINCLUDES = | |
INCLUDES = -I$(AUXINCLUDES) -I$(LOCALDEPSINCLUDES) |
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 <stdint.h> | |
#include <functional> | |
template <typename TFirst, typename TSecond> | |
struct HashablePair : public std::pair<TFirst, TSecond> { | |
typedef std::pair<TFirst, TSecond> Base; | |
public: | |
HashablePair() : Base() {}; | |
HashablePair(const Base& a) : Base(a) {}; |
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
//header file | |
struct MyStruct { | |
public: | |
const std::unordered_map<std::string, uint32_t> str_to_int{ | |
{ "a", 1 }, | |
{ "b", 2 }, | |
//... | |
{ "z", 26 } | |
}; |
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 os | |
import sys | |
import pdb | |
import traceback | |
try: | |
your code here | |
except: | |
type, value, tb = sys.exc_info() |
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
#ifndef MEM_POOL_H_ | |
#define MEM_POOL_H_ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <iostream> | |
#include <vector> | |
#define USE_CPLUSCPLUS_MEMORY_POOL_FOR_PARTS 1 | |
#define MEMORY_POOL_CHUNK_SIZE 1024 |
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
/** | |
* @file chrono.h | |
* @author David Alberto Nogueira (dan) | |
* @brief std::chrono wrapper. | |
* | |
* USAGE: | |
* @code{.cpp} | |
* chronowrap::Chronometer chrono; //Declare a Chronometer | |
* chrono.GetTime(); //Start timer | |
* { |
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
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
NewerOlder