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 com.amazonaws.regions.Regions; | |
import com.amazonaws.services.cloudformation.AmazonCloudFormationAsync; | |
import com.amazonaws.services.cloudformation.AmazonCloudFormationAsyncClientBuilder; | |
import com.amazonaws.services.sqs.AmazonSQS; | |
import com.amazonaws.services.sqs.AmazonSQSAsyncClientBuilder; | |
import org.springframework.cloud.aws.messaging.config.annotation.EnableSqs; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
/* |
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
class Auth0Test { | |
public static void main(String[] args) { | |
AuthAPI auth = new AuthAPI("my-domain", "client-id", "client-secret"); | |
AuthRequest authRequest = auth.login("user-email", "user-password"); | |
try { | |
TokenHolder tokenHolder = authRequest.execute(); | |
String accessToken = tokenHolder.getAccessToken(); | |
String idToken = tokenHolder.getIdToken(); |
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
class Auth0Test { | |
void getUserInfoFromAuthToken() { | |
AuthAPI auth = new AuthAPI("my-domain", "client-id", "client-secret"); | |
String accessToken = "accessToken"; | |
Request<UserInfo> userInfoRequest = auth.userInfo(accessToken); | |
try { | |
UserInfo user = userInfoRequest.execute(); |
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 com.amazonaws.regions.Regions; | |
import com.amazonaws.services.costexplorer.AWSCostExplorer; | |
import com.amazonaws.services.costexplorer.AWSCostExplorerClientBuilder; | |
import com.amazonaws.services.costexplorer.model.DateInterval; | |
import com.amazonaws.services.costexplorer.model.GetCostAndUsageRequest; | |
import com.amazonaws.services.costexplorer.model.GetCostAndUsageResult; | |
import com.amazonaws.services.costexplorer.model.Group; | |
import com.amazonaws.services.costexplorer.model.GroupDefinition; | |
import com.amazonaws.services.costexplorer.model.GroupDefinitionType; | |
import com.amazonaws.services.costexplorer.model.MetricValue; |
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 com.amazonaws.regions.Regions; | |
import com.amazonaws.services.costexplorer.AWSCostExplorer; | |
import com.amazonaws.services.costexplorer.AWSCostExplorerClientBuilder; | |
import com.amazonaws.services.costexplorer.model.DateInterval; | |
import com.amazonaws.services.costexplorer.model.GetCostAndUsageRequest; | |
import com.amazonaws.services.costexplorer.model.GetCostAndUsageResult; | |
import com.amazonaws.services.costexplorer.model.Group; | |
import com.amazonaws.services.costexplorer.model.GroupDefinition; | |
import com.amazonaws.services.costexplorer.model.GroupDefinitionType; | |
import com.amazonaws.services.costexplorer.model.MetricValue; |
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
public class DateTime { | |
public void printFirstAndLastDayOfThisMonth() { | |
Calendar calender = Calendar.getInstance(); | |
calender.roll(Calendar.MONTH, -1); | |
System.out.println("Minimum date " + calender.getActualMinimum(Calendar.DATE)); | |
System.out.println("Maximum date " + calender.getActualMaximum(Calendar.DATE)); | |
} | |
public void printFirstAndLastDayOfLastMonth() { |
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
public class RandomPassword { | |
private static String generateRandomPassword() { | |
Random random = new Random(); | |
char start = characters.charAt(Math.floorMod(random.nextInt(), characters.length())); | |
List<Character> chars = new ArrayList<>(); | |
for (int i = 0; i < 5; i++) { | |
chars.add(characters.charAt(Math.floorMod(random.nextInt(), characters.length()))); | |
} |
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
# ... | |
# Routes request on REST controller running on a Zuul Proxy | |
zuul.routes.tableau.retryable = true | |
zuul.routes.tableau.stripPrefix = true | |
zuul.routes.tableau.path = /api/v1//authorization/** | |
zuul.routes.tableau.url = forward:/api/v1/tableau/authorization | |
# ... |
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 socket | |
import logging | |
try: | |
# see if we can resolve the host name -- tells us if there is | |
# a DNS listening | |
host = socket.gethostbyname('www.google.com') | |
# connect to the host -- tells us if the host is actually | |
# reachable | |
s = socket.create_connection((host, 80), 2) |
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 java.io.*; | |
import java.math.*; | |
import java.security.*; | |
import java.text.*; | |
import java.util.*; | |
import java.util.concurrent.*; | |
import java.util.regex.*; | |
// https://www.hackerrank.com/challenges/new-year-chaos/copy-from/132089930 | |
public class Solution { |
OlderNewer