Keybase proof
I hereby claim:
- I am mattfaus on github.
- I am mattfaus (https://keybase.io/mattfaus) on keybase.
- I have a public key whose fingerprint is 1CF5 6643 9369 2689 9402 2358 69E8 0354 58E5 E154
To claim this, I am signing this object:
public function checkBuyOrders($currentBuyPrice) { | |
$sqlWhere = Array('status' => 'ACTIVE', 'action' => 'BUY', "$currentBuyPrice <= `at_price`"); | |
foreach ($this->context->orders->findAll()->where($sqlWhere) as $order) { //double check the price for each before buying | |
try { | |
$userAssociatedWithOrder = $this->context->authenticator->getUser($order->user_id); | |
if(!empty($order->at_price) && !empty($order->amount) && $userAssociatedWithOrder->coinbase_access_token){ //his Coinbase API tokens are set | |
$totalBuyPrice = $this->context->coinbase->user($order->user_id)->order($order)->getBuyPrice($order->amount); | |
if ($totalBuyPrice !== NULL && $totalBuyPrice->subtotal->amount <= $order->at_price * $order->amount) { | |
$result = $this->context->coinbase->user($order->user_id)->order($order)->buy($order->amount); //Buy the coins | |
$this->context->orders->findAll()->get($order->order_id)->update(Array('status' => 'EXECUTED')); //Update order status |
class TransformedVideoTranslationInfo(bq_property_transform.TransformedEntity): | |
CUSTOM_SCHEMAS = { | |
'translated_youtube_ids': { | |
'name': 'translated_youtube_ids', | |
'type': 'record', | |
'mode': 'repeated', | |
'fields': [ | |
{'name': 'language', | |
'type': 'string'}, |
import collections | |
import jinja2 | |
import logging | |
import os | |
import request_handler | |
import third_party.mapreduce | |
import third_party.mapreduce.input_readers | |
import third_party.mapreduce.output_writers | |
import third_party.mapreduce.lib.files | |
import third_party.mapreduce.operation |
def get_table_schema(dataset, table): | |
"""If the table exists, returns its schema. Otherwise, returns None.""" | |
table_service = BigQueryService.get_service().tables() | |
try: | |
get_result = table_service.get( | |
projectId=BQ_PROJECT_ID, | |
datasetId=dataset, | |
tableId=table | |
).execute() | |
return get_result['schema'] |
{ | |
u 'fields': [{ | |
u 'type': u 'STRING', | |
u 'name': u 'playlists', | |
u 'mode': u 'REPEATED' | |
}, { | |
u 'type': u 'STRING', | |
u 'name': u 'source_table', | |
u 'mode': u 'NULLABLE' | |
}, { |
class DeterministicCompressedFeatures(CompressedFeatures): | |
"""Generates random components after seeding with the component_key. | |
By using a known seed to generate the random components, we do not need to | |
store or manage them. We can just recompute them whenever we need. | |
""" | |
def __init__(self, num_features=RANDOM_FEATURE_LENGTH): | |
super(DeterministicallyRandomFeatures, self).__init__(num_features) |
class ParallelInMemorySortGcsCsvShardFiles(pipeline.Pipeline): | |
def run(self, input_bucket, input_pattern, sort_columns, | |
model_type, output_bucket, output_pattern): | |
"""Sorts each input file in-memory, then writes it to an output file. | |
Arguments: | |
input_bucket - The GCS bucket which contains the unsorted .csv | |
files. | |
input_pattern - A regular expression used to find files in the |
class BatchedGcsCsvShardFileWriter(object): | |
"""Writes CSV data into multiple output shards, grouping rows by keys. | |
This class is a context manager, which closes all shards upon exit. | |
Say you are writing a lot of CSV data, like: | |
[0, "Bakery"], | |
[2, "Francisco"], | |
[3, "Matt"], |
I hereby claim:
To claim this, I am signing this object:
import logging | |
import os | |
import sys | |
import time | |
from google.appengine.ext import db | |
import instance_cache | |
import user_util |