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
---[ REQUEST ]--------------------------------------- | |
POST /client/v4/zones/REDACTED/rulesets HTTP/1.1 | |
Host: api.cloudflare.com | |
User-Agent: terraform/1.3.3 terraform-plugin-sdk/2.10.1 terraform-provider-cloudflare/3.27.0 | |
Content-Length: 389 | |
Content-Type: application/json | |
X-Auth-Email: REDACTED | |
X-Auth-Key: REDACTED | |
Accept-Encoding: gzip |
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 {PubSub, v1} from '@google-cloud/pubsub'; | |
import logger from '#utils/logger'; | |
export async function moveMessages(options) { | |
const subClient = new v1.SubscriberClient(); | |
const publishClient = new PubSub({projectId: options.topicproject}); | |
const publisher = publishClient.topic(options.targettopic, { | |
batching: { | |
maxMessages: 100, | |
maxMilliseconds: 100, |
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
const myArgs = process.argv.slice(2); | |
let computedNum = 99999; | |
let numString = myArgs[0]; | |
while(computedNum > 9) { | |
let sum = 0; | |
for (var i = 0; i < numString.length; i++) { | |
sum += parseInt(numString.charAt(i)); | |
} |
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 {Command} from 'commander'; | |
import 'dotenv/config.js'; // eslint-disable-line import/no-unassigned-import | |
import {PubSub} from '@google-cloud/pubsub'; | |
const program = new Command(); | |
program | |
.requiredOption('-t, --targettopic <topic name>', 'Target topic to move messages to.') | |
.requiredOption('-tp, --topicproject <project>', 'Name of project where topic is defined.') |
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
#!/bin/sh | |
# Requests manage_project which is full control over project. | |
# Need to define: | |
# CT_PROJECT_KEY | |
# CT_CLIENT_ID | |
# CT_SECRET | |
# | |
# Example queries a product by id. | |
ctapiurl="https://api.us-central1.gcp.commercetools.com/$CT_PROJECT_KEY" | |
token=`curl https://$CT_CLIENT_ID:$CT_SECRET@auth.us-central1.gcp.commercetools.com/oauth/token -X POST -d "grant_type=client_credentials&scope=manage_project:$CT_PROJECT_KEY" | sed 's/{"access_token":"\([^"]*\).*/\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
import fs from 'fs'; | |
import path from 'path'; | |
import csv from '@fast-csv/parse'; | |
import { Parser } from 'json2csv'; | |
const myArgs = process.argv.slice(2); | |
const directoryPath = myArgs[0]; | |
const rows = []; |
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 Redis from 'ioredis'; | |
const redis = new Redis({ | |
keyPrefix: "hereIsAPrefixToNamespaceThings:", | |
port: 6379, | |
host: 'localhost', | |
db: 0, | |
connectTimeout: 10000, | |
}); |
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
""" gcloud storage helper functions """ | |
import json | |
import logging | |
import posixpath | |
from typing import Tuple, Any, Dict, List | |
from tenacity import retry, stop_after_attempt, wait_exponential | |
from google.cloud import storage | |
storage_client = storage.Client() |
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 14 columns, instead of 1. in line 8.
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
2020-04-20 21:00:00+00:00,0.89533,0.89664,0.88963,0.89218,0.89733,0.89733,0.88993,0.89287,0.89633,0.89677,0.8898,0.89252,236284 | |
2020-04-21 21:00:00+00:00,0.89215,0.89983,0.89112,0.89502,0.8929,0.90124,0.89136,0.89557,0.89252,0.9005,0.89125,0.8953,177029 | |
2020-04-22 21:00:00+00:00,0.8946,0.90112,0.89169,0.89633,0.89604,0.90164,0.89202,0.89676,0.89532,0.90128,0.89187,0.89654,187587 | |
2020-04-23 21:00:00+00:00,0.89608,0.902,0.89324,0.90008,0.89722,0.9027,0.89365,0.90208,0.89665,0.90225,0.89346,0.90108,149012 | |
2020-04-26 21:00:00+00:00,0.899,0.90973,0.89892,0.90706,0.901,0.91003,0.9009,0.90744,0.9,0.90982,0.89992,0.90725,146455 | |
2020-04-27 21:00:00+00:00,0.90646,0.91077,0.90363,0.90832,0.9077,0.91095,0.90445,0.9088,0.90708,0.91086,0.90426,0.90856,153814 | |
2020-04-28 21:00:00+00:00,0.90823,0.91213,0.90704,0.90972,0.90915,0.91235,0.9075,0.91017,0.90869,0.91222,0.90742,0.90994,130235 | |
2020-04-29 21:00:00+00:00,0.90988,0.9113,0.90253,0.90792,0.91032,0.91162,0.90282,0.90843,0.9101,0.91146,0.90269,0.90818,191082 | |
2020-04-30 21: |
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 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) |
NewerOlder