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
def deep_sum(elem): | |
result = 0 | |
for item in elem: | |
if hasattr(item, '__len__'): | |
result += deep_sum(item) | |
else: | |
result += item | |
return result | |
assert deep_sum([1, -5, [50, 50, [100, 100, [2, 2]]], 100]) == 400 |
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 datetime import datetime | |
from time import sleep | |
def memoice(func): | |
class MemoDict(dict): | |
def __init__(self, func): | |
super().__init__() | |
self.func = func |
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
@Bean | |
public RestTemplate keycloakAdminApiInsecure() { | |
try { | |
TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true; | |
SSLContext sslContext = org.apache.http.ssl.SSLContexts.custom() | |
.loadTrustMaterial(null, acceptingTrustStrategy) | |
.build(); | |
SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext); |
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.mashape.unirest.http.HttpResponse; | |
import com.mashape.unirest.http.JsonNode; | |
import com.mashape.unirest.http.Unirest; | |
import org.apache.http.conn.ssl.SSLConnectionSocketFactory; | |
import org.apache.http.conn.ssl.TrustStrategy; | |
import org.apache.http.impl.client.CloseableHttpClient; | |
import org.apache.http.impl.client.HttpClients; | |
import org.apache.http.ssl.SSLContexts; | |
import org.junit.Test; |
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
@Bean("non-ssl-validation") | |
public RestTemplate insecureRestTemplate() { | |
try { | |
TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true; | |
SSLContext sslContext = org.apache.http.ssl.SSLContexts.custom() | |
.loadTrustMaterial(null, acceptingTrustStrategy) | |
.build(); | |
SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext); |
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 com.example.demo.configuration; | |
import com.google.common.collect.Lists; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.security.access.AccessDecisionManager; | |
import org.springframework.security.access.AccessDecisionVoter; | |
import org.springframework.security.access.ConfigAttribute; | |
import org.springframework.security.access.vote.AuthenticatedVoter; | |
import org.springframework.security.access.vote.RoleVoter; |
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 | |
find ~/.m2 -name _remote.repositories -delete |
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 | |
find ~/.m2 -name *.lastUpdated -delete |
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
weißer Stecker: | |
1 - Kontrolleuchte Fernlicht | |
2 - Instrumentenbeleuchtung (Klemme 58g) | |
3 - Kontrolleuchte Blinker rechts | |
4 - Kontrolleuchte Blinker links | |
5 - Warnleuchte elektr. Getriebesteuerung | |
6 - nicht belegt | |
7 - nicht belegt | |
8 - Warnleuchte DDE |
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
// Add the follow Code Snippet to index.html from swagger-ui v2.x.x | |
// ... | |
window.swaggerUi = new SwaggerUi({ | |
url: url, | |
// --- --- --- ---- | |
useJQuery: true, | |
authorizations: { | |
makeCredentialed: function() { | |
this.xhrFields = {withCredentials: true}; // The important bit, along with useJQuery |
NewerOlder