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
#!/bin/bash | |
if [ $# -eq 0 ] | |
then | |
echo "./installCertificate.sh <HOSTNAME> <PORT>" | |
exit | |
fi | |
HOSTNAME=$1 | |
PORT=$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
import org.apache.commons.io.IOUtils; | |
import org.springframework.stereotype.Controller; | |
import org.springframework.web.bind.annotation.*; | |
import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody; | |
import java.io.IOException; | |
import java.net.HttpURLConnection; | |
import java.net.URL; | |
@Controller | |
public class StreamControllerExample { |
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 main | |
import ( | |
"os" | |
"log" | |
"path/filepath" | |
"strings" | |
) | |
func findFolderLike(dir string, match string) { |
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 main | |
import ( | |
"os" | |
"fmt" | |
"log" | |
"crypto/sha512" | |
"io/ioutil" | |
"path/filepath" | |
) |
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 ssl | |
from flask import json | |
from ldap3 import Server, \ | |
Connection, \ | |
SUBTREE, \ | |
ALL_ATTRIBUTES, \ | |
Tls, MODIFY_REPLACE | |
OBJECT_CLASS = ['top', 'person', 'organizationalPerson', 'user'] |
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 os | |
from pathlib import Path | |
current_dir = os.path.dirname(__file__) | |
version_file_full_path = os.path.join(current_dir, "VERSION.txt") | |
""" | |
Create and obtain version information based on environment variables: | |
* APP_MAJOR_VERSION |
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 flask import Flask, g, request | |
from flask import render_template, redirect | |
app = Flask(__name__) | |
def after_this_request(f): | |
if not hasattr(g, 'after_request_callbacks'): | |
g.after_request_callbacks = [] | |
g.after_request_callbacks.append(f) | |
return f |
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 unittest.mock import patch, Mock | |
from requests import Response | |
import requests | |
import unittest | |
def health_check(endpoint): | |
return requests.get(endpoint).status_code | |
class TestHealthCheck(unittest.TestCase): |
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
x = {'a': 1, 'b': 2} | |
y = {'b': 3, 'c': 4} | |
def merge_two_dicts_python3(): | |
z = {**x, **y} | |
print(z) # {'c': 4, 'a': 1, 'b': 3} | |
def merge_two_dicts_python2(): | |
z = dict(x, **y) | |
print(z) # {'a': 1, 'c': 4, 'b': 3} |