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
| param ( | |
| [string]$file = $(throw "-file is required"), | |
| [string]$ftphostpath = $(throw "-ftphostpath is required"), | |
| [string]$username = $(throw "-username is required"), | |
| [string]$password = $(throw "-password is required") | |
| ) | |
| $f = dir $file | |
| $req = [System.Net.FtpWebRequest]::Create("ftp://$ftphostpath/" + $f.Name); | |
| $req.Credentials = New-Object System.Net.NetworkCredential($username, $password); |
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
| [Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem'); | |
| [System.IO.Compression.ZipFile]::CreateFromDirectory($directoryTozip, "$output.zip"); |
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 com.fearlesstg.dataflow.pipelines; | |
| import java.util.*; | |
| import com.fasterxml.jackson.databind.ObjectMapper; | |
| import com.fasterxml.jackson.databind.SerializationFeature; | |
| import com.google.api.services.bigquery.model.TableRow; | |
| import org.apache.beam.sdk.coders.StringUtf8Coder; | |
| import org.apache.beam.sdk.io.Compression; | |
| import org.apache.beam.sdk.io.FileIO; |
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 com.fearlesstg; | |
| import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; | |
| import com.google.api.client.http.HttpTransport; | |
| import com.google.api.client.http.javanet.NetHttpTransport; | |
| import com.google.api.client.json.JsonFactory; | |
| import com.google.api.client.json.jackson.JacksonFactory; | |
| import com.google.api.services.bigquery.Bigquery; | |
| import com.google.api.services.bigquery.BigqueryScopes; | |
| import com.google.api.services.bigquery.model.*; |
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 com.fearlesstg; | |
| import com.google.api.services.bigquery.model.TableFieldSchema; | |
| import com.google.api.services.bigquery.model.TableRow; | |
| import com.google.api.services.bigquery.model.TableSchema; | |
| import com.google.api.services.bigquery.model.TimePartitioning; | |
| import org.apache.beam.sdk.Pipeline; | |
| import org.apache.beam.sdk.io.gcp.bigquery.BigQueryIO; | |
| import org.apache.beam.sdk.io.gcp.bigquery.TableDestination; | |
| import org.apache.beam.sdk.options.PipelineOptions; |
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 com.google.api.services.bigquery.model.TableRow; | |
| import com.google.api.services.bigquery.model.TimePartitioning; | |
| import org.apache.beam.sdk.io.gcp.bigquery.TableDestination; | |
| import org.apache.beam.sdk.transforms.SerializableFunction; | |
| import org.apache.beam.sdk.values.ValueInSingleWindow; | |
| import org.slf4j.Logger; | |
| import org.slf4j.LoggerFactory; | |
| //From: https://shinesolutions.com/2017/12/05/fun-with-serializable-functions-and-dynamic-destinations-in-cloud-dataflow/ | |
| public class GetTableShardPartition implements SerializableFunction<ValueInSingleWindow<TableRow>, TableDestination> { |
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
| from google.cloud import storage | |
| import sys | |
| from avro.datafile import DataFileReader | |
| from avro.io import DatumReader | |
| import json | |
| client = storage.Client() | |
| bucket_name = sys.argv[1] | |
| blob_name = sys.argv[2] |
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
| from google.cloud import storage | |
| from airflow.hooks.base_hook import BaseHook | |
| from airflow.utils.log.logging_mixin import LoggingMixin | |
| import random | |
| import string | |
| class GCSCustomHook(BaseHook, LoggingMixin): | |
| def __init__(self, storage_conn_id='google_cloud_storage_default'): |
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
| terraform plan | |
| 2020/01/03 14:33:49 [WARN] Log levels other than TRACE are currently unreliable, and are supported only for backward compatibility. | |
| Use TF_LOG=TRACE to see Terraform's internal logs. | |
| ---- | |
| 2020/01/03 14:33:49 [INFO] Terraform version: 0.12.18 | |
| 2020/01/03 14:33:49 [INFO] Go runtime version: go1.12.13 | |
| 2020/01/03 14:33:49 [INFO] CLI args: []string{"/usr/local/bin/terraform", "plan"} | |
| 2020/01/03 14:33:49 [DEBUG] Attempting to open CLI config file: /Users/peter/.terraformrc | |
| 2020/01/03 14:33:49 [DEBUG] File doesn't exist, but doesn't need to. Ignoring. | |
| 2020/01/03 14:33:49 [INFO] CLI command args: []string{"plan"} |
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 pandas as pd | |
| import pandas_ta as ta | |
| from dateutil import parser | |
| df = pd.read_csv('AUD_CAD.csv', sep=',', names=[ | |
| 'datetime', 'bid_open', 'bid_high', 'bid_low', 'bid_close', 'ask_open', 'ask_high', 'ask_low', 'ask_close', 'mid_open', 'mid_high', 'mid_low', 'mid_close', 'volume'], error_bad_lines=False, parse_dates=['datetime']) | |
| df.ta.atr(append=True, high='bid_high', low='bid_low', close='bid_close') | |
| print(df) |
OlderNewer