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 java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
//Example Input Strings | |
//String filterby = [ "13|123.12|123.service|1.12|123.service|2", "service|1.12|123.service|2", "service|1.service|2", "13|123.12|123.12|123", "13|123", "service|1" ] | |
//Filter services from filterby | |
String[] results = filterby.split("\\.?service\\|\\d+"); | |
StringBuilder sb = new StringBuilder(); | |
for( String result in results) { |
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 | |
//bin/true && SCRIPT_DIR="$(dirname $(readlink -f "${0}"))" | |
//bin/true && exec groovy -cp "${SCRIPT_DIR}/lib" "${0}" "${@}"; exit $? | |
/* | |
* Given N elements (with N = 6): | |
* | |
* ['C', 'G', 'Q', 'F', 'M', 'E'] | |
* | |
* and given a matrix NxP where P is the number of permutations of N |
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 proxyIpAddress = "192.168.0.1"; | |
String proxyPort = "80"; | |
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection( | |
new Proxy( Proxy.Type.HTTP, | |
new InetSocketAddress(proxyIpAddress, proxyPort) ) //close new Proxy | |
); //close url.openConnection |
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 | |
//bin/true && SCRIPT_DIR="$(dirname $(readlink -f "${0}"))" | |
//bin/true && exec groovy -cp "${SCRIPT_DIR}/lib" "${0}" "${@}"; exit $? | |
@Grab(group='ch.ethz.ganymed', module='ganymed-ssh2', version='262') | |
import ch.ethz.ssh2.* | |
String hostname = "localhost"; | |
String username = "gsus"; |
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 java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
String input = "https://test-landing.seat.it/Ristoranti_di_SCHIRALLI_ANTONIO_14b9/home.html"; | |
//Extract services | |
final Pattern landingPattern = Pattern.compile(":\\/\\/.*\\/(.*)\\/"); | |
Matcher m = landingPattern.matcher(input); | |
if(m.find()) { |
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 re | |
from functools import partial | |
pattern = '^[a-zA-Z0-9-_]*_(?P<pos>[A-Z]\d\d)_T\d{4}(?P<fID>F\d{3})L\d{2}A\d{2}(?P<zID>Z\d{2})(?P<cID>C\d{2})\.tif$' | |
filename = '151006_655866_Z01_T0001F015L01A02Z01C03.tif' | |
def replace_closure(subgroup, replacement, m): | |
if m.group(subgroup) not in [None, '']: | |
start = m.start(subgroup) |
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 | |
# set -e: if a command fails, it will make the whole script exit | |
# set -u: treat unset variables as an error, and immediately exit. | |
set -eu | |
SCRIPT_NAME="${0##*/}" | |
usage() { | |
echo "${SCRIPT_NAME} usage:" | |
echo '<*> [-P | --profile] <local|test|production>' |
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
// Apply the java plugin to add support for Java | |
apply plugin: 'java' | |
// Apply the application plugin to run standalone artifacts | |
apply plugin: 'application' | |
// In this section you declare where to find the dependencies of your project | |
repositories { | |
// Use 'jcenter' for resolving your dependencies. | |
// You can declare any Maven/Ivy/file repository here. | |
jcenter() |
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 it.italiaonline.rnd.filters.TextFilter; | |
/** | |
* This class includes simple test cases for the SmartCap filter | |
* <p> | |
* A couple of arrays are defined with input / expected_output and a for loop | |
* to couple them checking against the SmartCap filter. | |
* @author Giuseppe Ricupero | |
* @date 27/06/16 09.12 | |
*/ |
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 it.italiaonline.rnd.filters.TextFilter; | |
/** | |
* This class includes simple test cases for the AddressSmartCap filter | |
* <p> | |
* A couple of arrays are defined with input / expected_output and a for loop | |
* to couple them checking against the SmartCap filter. | |
* @author Giuseppe Ricupero | |
* @date 26/10/16 10.26 | |
*/ |
OlderNewer