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
# frozen_string_literal: true | |
# Struct representing an order (limit or market) | |
Order = Struct.new(:uid, :user_id, :price, :quantity, :type, :side) | |
# Struct representing a successful match between a market and a limit order | |
OrderMatch = Struct.new(:uid, :limit_order_id, :market_order_id, :amount) | |
class Level | |
EPSILON = 1e-8 # Used to compare floating point numbers safely |
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
# frozen_string_literal: true | |
module UpcoachService | |
class RequestValidator < ApplicationService | |
def initialize(full_url, signing_secret) | |
@full_url = full_url | |
@signing_secret = signing_secret | |
end | |
def call |
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
'''Trains a simple deep NN on the MNIST dataset. | |
Gets to 98.40% test accuracy after 20 epochs | |
(there is *a lot* of margin for parameter tuning). | |
2 seconds per epoch on a K520 GPU. | |
Using to benchmark my deep learning box. | |
''' | |
from __future__ import print_function |
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 | |
from timeit import default_timer as timer | |
from math import log | |
def sigmoid(x): | |
return 1 / (1 + np.exp(-x)) | |
class Person(object): | |
def __init__(self, input, hidden, output): | |
self.fitness = 0 |
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 nested | |
import ( | |
"errors" | |
"fmt" | |
"strconv" | |
"testing" | |
"github.com/stretchr/testify/assert" | |
) |
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 main | |
import ( | |
"log" | |
"net/http" | |
"sync" | |
"github.com/garyburd/redigo/redis" | |
"github.com/gorilla/websocket" | |
uuid "github.com/satori/go.uuid" |
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
// Suppose we have a permutation containing N different elements. | |
// Heap found a systematic method for choosing at each step a pair of elements to switch, | |
// in order to produce every possible permutation of these elements exactly once. | |
// Let us describe Heap's method in a recursive way. First we set a counter i to 0. | |
// Now we perform the following steps repeatedly until i is equal to N. | |
// We use the algorithm to generate the (N − 1)! permutations of the first N − 1 elements, | |
// adjoining the last element to each of these. This generates all of the permutations that | |
// end with the last element. Then if N is odd, we switch the first element and the last one, | |
// while if N is even we can switch the i th element and the last one (there is no difference between | |
// N even and odd in the first iteration). We add one to the counter i and repeat. In each iteration, |
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 | |
# First add a new sudo user to system | |
# sudo adduser xx sudo | |
# Second change ssh login to key only | |
# https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2 | |
# And then run this file | |