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/bash | |
oc login | |
oc project $1 | |
oc get services | awk '{print $1}' | grep -v NAME | xargs -I % oc delete all -l app=% |
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 functools import reduce | |
check = [1, 2, 3, 4, 5] | |
if __name__ == '__main__': | |
print(list(map(lambda x: x * 3, check))) # OUTPUT: [3, 6, 9, 12, 15] | |
print(list(filter(lambda x: x < 3, check))) # OUTPUT: [1, 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
@Configuration | |
@EnableWebMvc | |
public class WebApplicationConfig implements WebMvcConfigurer { | |
@Override | |
public void configureViewResolvers(ViewResolverRegistry registry) { | |
registry.jsp().prefix("/WEB-INF/views/").suffix(".jsp"); | |
} | |
} |
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
@Configuration | |
public class ThymeLeafConfig { | |
@Autowired | |
private SpringResourceTemplateResolver templateResolver; | |
@Bean | |
public SpringTemplateEngine templateEngine(){ | |
SpringTemplateEngine templateEngine = new SpringTemplateEngine(); | |
templateEngine.setEnableSpringELCompiler(true); |
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 nodeName | |
stage("ArchiveDockerData") { | |
def nodeNameList = nodeNames() | |
for (String n : nodeNameList) { | |
nodeName = n | |
echo "Docker info for ${nodeName}" | |
timeout(time: 5, unit: 'SECONDS') { | |
try { | |
node(nodeName) { |
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 urllib | |
import re | |
def getSequenceDiagram(text, output_file, style ='default'): | |
request = {} | |
request["message"] = text | |
request["style"] = style | |
request["apiVersion"] = "1" | |
url = urllib.urlencode(request) |
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.clients.jedis.Jedis; | |
import java.nio.file.Files; | |
import java.nio.file.Path; | |
import java.nio.file.Paths; | |
import static java.lang.System.getenv; | |
public class JavaRedisCSVUploadExample { |
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
python -c "import site; print(site.getsitepackages())" |
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 asyncio | |
from pymongo import MongoClient | |
@asyncio.coroutine | |
def periodic(wait_seconds=2): | |
while True: | |
names = client['local'].collection_names() | |
for name in names: | |
print(name) | |
yield from asyncio.sleep(wait_seconds) |
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
Optional<String> name = Optional.empty(); | |
Optional<String> alternativeName = Optional.of("john"); | |
name = name.or(() -> alternativeName); | |
name.get(); // Outputs "john" |
NewerOlder