This file contains 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
class Parser: | |
def __init__(self, text): | |
self.text = ''.join(text.split()) | |
self.pos = 0 | |
def parse(self): | |
return self.parse_expression() | |
def parse_expression(self): | |
result = self.parse_term() |
This file contains 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 <openssl/evp.h> | |
#include <openssl/kdf.h> | |
#include <openssl/objects.h> | |
#include <openssl/crypto.h> | |
#include <openssl/core_names.h> | |
#include <openssl/obj_mac.h> | |
#include <openssl/bio.h> | |
#include <openssl/err.h> | |
#include <openssl/ec.h> |
This file contains 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 time | |
np.random.seed(281) | |
def generate_graph(n, p, k): | |
G = (np.random.rand(n, n) <= p).astype(np.int32) | |
G[np.triu_indices(n)] = 0 | |
# Random integer weighing scheme | |
for x in np.nditer(G, op_flags=['writeonly']): |
This file contains 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 java.io.*; | |
import java.util.*; | |
class Main { | |
public static void main(String[] args) throws IOException { | |
File file = new File(args[0]); | |
char[][] board = new char[9][9]; | |
BufferedReader buffer = new BufferedReader(new FileReader(file)); | |
for (int i = 0; i < 9; i++) { | |
for (int j = 0; j < 9; j++) { |
This file contains 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 Paths | |
LIB_OPENCV4_PATH=/usr/local/Cellar/opencv/4.1.0_2/lib | |
LIB_RS2_PATH=/Users/nguyenluongminh/librealsense/build | |
#Include Paths | |
INCLUDE_OPENCV4_PATH=/usr/local/Cellar/opencv/4.1.0_2/include/opencv4 | |
INCLUDE_RS2_PATH =/Users/nguyenluongminh/librealsense/include/librealsense2 | |
INCLUDE_IMGUI_PATH =/Users/nguyenluongminh/librealsense/build | |
#Linker |
This file contains 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 fractions import Fraction | |
import numpy as np | |
def print_matrix(matrix): | |
def tostr(i): | |
return str(i) if i.denominator == 1 else '{}\\{}'.format(i.numerator, i.denominator) | |
print '\n'.join(['\t'.join([tostr(col) for col in row]) for row in matrix]) | |
This file contains 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": { | |
"version": "3.1", | |
"division": [ | |
{ | |
"alias": "tx2_64bit", | |
"selected": "1", | |
"name": "Jetson TX2" | |
}, | |
{ |
This file contains 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 | |
def sigmoid(v): | |
return 1 / (1 + np.exp(-v)) | |
def one_hot(x): | |
N = x.size | |
D = x.max() + 1 |
This file contains 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
# Sometimes it works, sometimes it doesn't | |
import numpy as np | |
import gym | |
class Net(object): | |
def __init__(self, input, output): | |
# W = 0.01 * np.random.randn(input, output) | |
# b = np.zeros([1, output]) # Random initialization | |
W = np.array([[-0.60944746, 0.45539405], |
This file contains 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 matplotlib.pyplot as plt | |
from tensorflow.examples.tutorials.mnist import input_data | |
def sample_vector(v, w, b, bernoulli=True): | |
h = 1 / (1 + np.exp(-(v.dot(w) + b))) | |
if bernoulli: | |
h = np.random.binomial(1, h) | |
return h |
NewerOlder