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
@Configuration | |
public class WebSecurity extends WebSecurityConfigurerAdapter { | |
@Override | |
protected void configure(HttpSecurity http) throws Exception { | |
http | |
.csrf().disable() | |
.authorizeRequests() | |
.antMatchers(HttpMethod.OPTIONS, "**").permitAll()//allow CORS option calls | |
.anyRequest().authenticated(); |
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
@RequestMapping("/job/start") | |
public String start() throws ExecutionException, InterruptedException { | |
ExecutorService executor = Executors.newSingleThreadExecutor(); | |
executor.submit(() -> { | |
try { | |
System.out.println("BGController.before"); | |
Thread.sleep(10000); | |
System.out.println("BGController.after"); | |
} catch (InterruptedException e) { |
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
String cer = "/home/luis/Downloads/APImIntranet.cer"; | |
FileInputStream fileInputStream = new FileInputStream(cer); | |
CertificateFactory cf = CertificateFactory.getInstance("X.509"); | |
X509Certificate cert = (X509Certificate)cf.generateCertificate(fileInputStream); | |
PublicKey publicKey = cert.getPublicKey(); | |
byte[] encoded = publicKey.getEncoded(); | |
byte[] b64key = Base64.getEncoder().encode(encoded); | |
System.out.println("b64key = " + new String(b64key)); |
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 | |
# use: proxy.sh on|off | |
cp /etc/squid/squid.conf.proxy-$1 /etc/squid/squid.conf | |
echo "restarting squid" | |
service squid restart | |
echo 'Proxy ' $1 |
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
"use strict"; | |
var client = require("cloud-config-client"); | |
const options = { | |
application: "devstack-sample-persons", | |
profiles: ["production"] | |
}; | |
client.load(options, function(error, cfg) { |
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
#!/usr/bin/env groovy | |
def proxyParams = "" | |
def jsonUri = "https://api.gopro.com/v2/channels/feed/playlists/photo-of-the-day.json?platform=web" | |
//def data = get(jsonUri) | |
def commandJson = "wget -q -O - " + jsonUri + proxyParams | |
def data = commandJson.execute().text | |
json = new groovy.json.JsonSlurper().parseText(data) |
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 "fmt" | |
import "net/http" | |
func main() { | |
resp, error := http.Get("https://www.google.com/") | |
fmt.Println(resp) | |
fmt.Println(error) | |
} |
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 ( | |
"flag" | |
"fmt" | |
) | |
func main() { | |
var cmd string | |
var i bool |
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
#!/usr/bin/env groovy | |
def cli = new CliBuilder(usage: 'cli', stopAtNonOption: false) | |
cli.n('Force numeric on property set') | |
cli.h(longOpt: 'help', 'Show usage information') | |
cli.c(longOpt: 'config-server', args:1, argName:'server', 'Config server url') | |
cli.p(longOpt: 'profile', args:1, argName:'profile', 'Profile') | |
cli.l(longOpt: 'label', args:1, argName:'label', 'Label') | |
cli.u(longOpt: 'credentials', args:1, argName:'user:pass', 'Basic credentials') |
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
http = require("http"); | |
function sleep(milliSeconds, callback) { | |
var startTime = new Date().getTime(); | |
while (new Date().getTime() < startTime + milliSeconds); | |
} | |
server = http.createServer(function (request, response) { | |
console.log(request); | |
console.log('a request'); |
NewerOlder