Skip to content

Instantly share code, notes, and snippets.

View hurtigcodes's full-sized avatar
🍉

Oskar Hurtig hurtigcodes

🍉
View GitHub Profile
@hurtigcodes
hurtigcodes / ProcessBuilder.java
Last active April 20, 2023 08:57
Notes: using ProcessBuilder API with pipelines
public static void main(String[] args) throws IOException, InterruptedException {
String homeDirectory = System.getProperty("user.home");
ProcessBuilder processBuilder = new ProcessBuilder("/bin/sh", "-c", "echo hello");
ProcessBuilder processBuilder2 = new ProcessBuilder("/bin/sh", "-c", "src/script.sh");
// inheritIO() method we see the output of a simple command in the console in our IDE.
// use this method when we want to redirect the sub-process I/O to the standard I/O of the current process:
processBuilder.inheritIO();
// ProcessBuilder processBuilder = new ProcessBuilder( "node", "-v");
@hurtigcodes
hurtigcodes / redirect.java
Last active April 20, 2023 08:56
Redirect requests with Spring
@Hidden
@GetMapping("/")
public ModelAndView redirect(ModelMap model) {
// model.addAttribute("attribute", "redirectWithRedirectPrefix");
return new ModelAndView("redirect:/swagger-ui.html", model);
}
@hurtigcodes
hurtigcodes / giphy.gif
Last active April 29, 2021 10:39
fine
giphy.gif