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
// -*- coding:utf-8; mode:c++; mode:auto-fill; fill-column:80; -*- | |
/// @file slurp.hpp | |
/// @brief Slurps a file into an std::string. | |
/// @author J. Arrieta <Juan.Arrieta@nablazerolabs.com> | |
/// @copyright Copyright (c) 2016 Nabla Zero Labs. All rights reserved. | |
/// @license This software is released under the MIT License. | |
/// | |
/// The MIT License (MIT) | |
/// Copyright (c) 2016 Nabla Zero Labs |
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
// -*- coding:utf-8; mode:c++; mode:auto-fill; fill-column:80; -*- | |
/// @file list.hpp | |
/// @brief A minimal list implementation copying the style of the C++ | |
/// Standard Library --- it is meant for educational purposes. | |
/// @author J. Arrieta <Juan.Arrieta@nablazerolabs.com> | |
/// @copyright Copyright (c) 2016 Nabla Zero Labs. All rights reserved. | |
/// @license This software is released under the MIT License. | |
/// @warning Do not use this turd in production code, or for anything that is | |
/// not strictly educational. Just use std::list (actually you most |
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
// -*- coding:utf-8; mode:c++; mode:auto-fill; fill-column:80; -*- | |
/// @file example-linspace.cpp | |
/// @brief Sample use of Nabla Zero Labs' linspace utilities. | |
/// @author J. Arrieta <Juan.Arrieta@nablazerolabs.com> | |
/// @date November 01, 2017 | |
/// @copyright (c) 2017 Nabla Zero Labs | |
/// @license MIT License | |
// C++ Standard Library |
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
def lcs(s1, s2): | |
def lcs_(s1, s2, m, n): | |
if (m < 0) or (n < 0): | |
return 0 | |
elif s1[m] == s2[n]: | |
return 1 + lcs_(s1, s2, m - 1, n - 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
def longest_palindrome_constant_space(s): | |
N = len(s) | |
if N == 0: | |
return 0 | |
elif N == 1: | |
return 1 | |
elif N == 2: | |
return 1 + (s[0] == s[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
def T(n): | |
memo = { | |
1 : (0, "<Base>"), | |
2 : (1, " / 2"), | |
3 : (1, " / 3") | |
} | |
def build_memo(n): |
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
""" | |
knapsack.py | |
Solve small knapsack problems by different methods. | |
(C) 2017 J. Arrieta, Nabla Zero Labs | |
MIT License | |
""" |
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
/* | |
This program implements a lexer for the Object Description Language (ODL), a legacy metadata format | |
used by NASA's Planetary Data System (PDS). | |
As of this writing, the ODL version is 2.1, and the specification can be found in: | |
https://pds.jpl.nasa.gov/documents/sr/Chapter12.pdf | |
This lexer simply emits the tokens needed by an ODL parser, which is provided as a separate program. |
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
/* | |
A simple pattern for thread-safe, read-only access to an existing, fixed, | |
contiguous memory slice. | |
This pattern is useful when simple chunking would be undesirable. For example: | |
A job may consist of three hard (H) tasks, each lasting two seconds, and three | |
easy (E) tasks, each lasting one second. If we simply pass the first three to | |
one thread, and the last three to a second thread, the second thread will | |
finish after three seconds, and leave the first thread to finish six seconds | |
worth of work. (total runtime: six seconds). The proposed approach would take |
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
""" | |
A brief explanation of WSGI middleware. | |
Nabla Zero Labs | |
""" | |
# The main WSGI application returns the string "Hello, {ip_address}!", where | |
# `ip_address` is the IP address of the host making the request. | |
def application(environ, start_response): | |
print("Main application") |
OlderNewer