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 * as lambda from 'aws-lambda' | |
import connectionOptions from '../db/ConnectionOptions' | |
import { Connection } from 'typeorm' | |
import { Database } from '../db' | |
import { User } from '../entities' | |
import 'reflect-metadata' | |
import 'envkey' | |
exports.api = async (event: lambda.APIGatewayProxyEvent, serverlessContext: lambda.Context) => { | |
// This enables Lambda function to complete |
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 { Connection, ConnectionManager, ConnectionOptions, createConnection, getConnectionManager } from 'typeorm' | |
import { inspect } from 'util' | |
import { SnakeNamingStrategy } from './SnakeNamingStrategy' | |
import 'envkey' | |
/** | |
* Database manager class | |
*/ | |
export class Database { | |
private connectionManager: ConnectionManager |
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
# You possess bitcoins in the form of UTXOs sorted by date and you need to send your friend X bitcoins. | |
# Find a date range whose outputs that will result in the least amount of change. | |
# Ideal solution will use Python whose function find_range(utxos, x) will give back the start and end dates. | |
# Each utxo has value and date (in unix time) | |
class UTXO(object): | |
def __init__(self, value, date): | |
self.value = value | |
self.date = date # unix time |