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
object PrefixCalculator { | |
def sumIpv4(ipv4Prefixes: Seq[Int]) : Int = doSumIpvX(ipv4Prefixes, 32) | |
def sumIpv6(ipv6Prefixes: Seq[Int]) : Int = doSumIpvX(ipv6Prefixes, 128) | |
private def doSumIpvX(prefixes: Seq[Int], bitSize: Int) : Int = { | |
val addressSize = prefixes.map(prefix => Math.pow(2, bitSize - prefix)).sum | |
(bitSize - (Math.log(addressSize) / Math.log(2))).floor.toInt | |
} |
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'; | |
angular.module('portal') | |
.factory('PrefixCalculator', function () { | |
/** | |
* Sums up the prefixLengths given a specified bitSize | |
* | |
* @param prefixes prefixLength integers (e.g. 22, 39 etc) | |
* @param bitSize the bitSize of the IP (e.g. 32 or 128) |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Form latin-1 input validation</title> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.10/angular.min.js"></script> | |
<script type="text/javascript"> | |
(function(angular) { | |
'use strict'; |
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
import com.fasterxml.jackson.databind.ObjectMapper; | |
import com.fasterxml.jackson.datatype.joda.JodaModule; | |
import com.fasterxml.jackson.module.afterburner.AfterburnerModule; | |
public interface JsonMapper { | |
ObjectMapper mapper = ObjectMapperWrapper.init(); | |
class ObjectMapperWrapper { | |
private static com.fasterxml.jackson.databind.ObjectMapper init() { |
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 aa.web; | |
import org.springframework.core.MethodParameter; | |
import org.springframework.http.MediaType; | |
import org.springframework.http.converter.HttpMessageConverter; | |
import org.springframework.http.server.ServerHttpRequest; | |
import org.springframework.http.server.ServerHttpResponse; | |
import org.springframework.http.server.ServletServerHttpRequest; | |
import org.springframework.web.bind.annotation.ControllerAdvice; | |
import org.springframework.web.filter.OncePerRequestFilter; |
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 eduproxy.saml; | |
import org.springframework.core.io.Resource; | |
import org.springframework.util.StringUtils; | |
import javax.xml.stream.XMLInputFactory; | |
import javax.xml.stream.XMLStreamException; | |
import javax.xml.stream.XMLStreamReader; | |
import java.io.IOException; | |
import java.util.HashMap; |
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
import org.apache.commons.io.IOUtils; | |
import sun.security.tools.keytool.CertAndKeyGen; | |
import sun.security.x509.X500Name; | |
import java.io.ByteArrayInputStream; | |
import java.io.IOException; | |
import java.security.*; | |
import java.security.cert.CertificateException; | |
import java.security.cert.CertificateFactory; | |
import java.security.cert.X509Certificate; |
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
import I18n from "i18n-js"; | |
import en from "../locale/en"; | |
import nl from "../locale/nl"; | |
expect.extend({ | |
toContainKey(translation, key) { | |
const pass = (translation[key] !== undefined); | |
return { | |
message: () => `Expected ${key} to be present in ${JSON.stringify(translation)}`, | |
pass: pass |
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 myconext.crypto; | |
import org.bouncycastle.asn1.x500.X500Name; | |
import org.bouncycastle.cert.CertIOException; | |
import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter; | |
import org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder; | |
import org.bouncycastle.jce.provider.BouncyCastleProvider; | |
import org.bouncycastle.openssl.jcajce.JcaPEMWriter; | |
import org.bouncycastle.operator.ContentSigner; | |
import org.bouncycastle.operator.OperatorCreationException; |
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
module.exports = { | |
presets: [ | |
[ | |
'@babel/preset-env', | |
{ | |
debug: true, | |
"corejs": 3, | |
"useBuiltIns": "entry", | |
targets: ['last 2 versions', 'ie >= 11'] | |
}], |
OlderNewer