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
from http.server import SimpleHTTPRequestHandler, HTTPServer | |
# install the ngrok page with `pip install ngrok` | |
import ngrok, logging | |
# RequestHandler -- A handler to create simple HTTP server that services specified HTML file | |
class RequestHandler(SimpleHTTPRequestHandler): | |
def do_GET(self): | |
# Set the request path to 'index.html' | |
self.path = 'index.html' | |
return SimpleHTTPRequestHandler.do_GET(self) |
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
services: | |
static-site: | |
image: dockersamples/static-site | |
build: . | |
ports: | |
- "80:80" | |
restart: always | |
ngrok: | |
image: ngrok/ngrok:latest | |
command: http http://host.docker.internal:80 --domain=scott-docker.ngrok.pizza |
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
package main | |
import ( | |
"bytes" | |
"context" | |
"encoding/json" | |
"fmt" | |
"io/ioutil" | |
"log" | |
"net/http" |
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
from pdpyras import APISession | |
import os | |
# api_token: an API key for the PagerDuty account with read/write access | |
# - To create API key see https://support.pagerduty.com/docs/generating-api-keys | |
api_token = os.getenv('PD_API_KEY') | |
session = APISession(api_token) | |
# Sample to create an AppDynamics Integration |
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 pdpyras | |
import time | |
from pdpyras import APISession | |
# API Token and Session for REST API | |
api_token = 'your_api_token' | |
rest_session = APISession(api_token) | |
# Routing Key and Session for Events API | |
routing_key = 'your_routing_key' |
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
#!/usr/bin/env python | |
import smartsheet | |
import os | |
import json | |
import logging | |
logging.basicConfig(filename='mylog.log', level=logging.DEBUG) | |
ss_client = smartsheet.Smartsheet(os.environ['SMARTSHEET_ACCESS_TOKEN']) | |
ss_client.errors_as_exceptions() |
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
#!/usr/bin/env python | |
import smartsheet | |
import os | |
import json | |
import datetime | |
ss_client = smartsheet.Smartsheet(os.environ['SMARTSHEET_ACCESS_TOKEN']) | |
ss_client.errors_as_exceptions() | |
sheet_ID = 2089332342318980 |
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
#!/usr/bin/env python | |
import smartsheet | |
import os | |
import json | |
ss_client = smartsheet.Smartsheet(os.environ['SMARTSHEET_ACCESS_TOKEN']) | |
ss_client.errors_as_exceptions() | |
sheet_ID = xxxxxxxxxxxxxxxx |
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 is a sample for creating an UpdateRequest in Smartsheet | |
private static void createUpdateRequest() throws SmartsheetException { | |
Token token = new Token(); | |
// Generate third party access token in Smartsheet. | |
// To learn how: https://smartsheet-platform.github.io/api-docs/?java#direct-api-access | |
token.setAccessToken("third-party-access-token"); | |
// Use the Smartsheet Builder to create a Smartsheet object | |
Smartsheet smartsheet = new SmartsheetBuilder().setAccessToken(token.getAccessToken()).build(); | |
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
private static JsonNode lowercaseNodeNames(JsonNode node) { | |
ObjectMapper mapper = new ObjectMapper(); | |
ObjectNode loweredNode = mapper.createObjectNode(); | |
Iterator<String> fieldNames = node.fieldNames(); | |
while (fieldNames.hasNext()) { | |
String currentName = fieldNames.next(); | |
JsonNode currentValue = null; | |
if (node.get(currentName).isObject()) { | |
// checking for nestedNode in currentNode |