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 normalizePostcode(String postcode, String country) { | |
Map<String, List<String>> rules = new TreeMap<String, List<String>>() {{ | |
put("Netherlands", Arrays.asList("(NL-)?(\\d{4})\\W*([A-Z]{2})", , "\$2\$3")); | |
put("United Kingdom", Arrays.asList("(?i)([A-Z]{1,2}[0-9]{1,2}[A-Z]?)\\s*([0-9][A-Z]{2})", "\$1\$2")); | |
}} | |
Pattern pattern = Pattern.compile(rules.get(country).get(0)); |
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
CREATE OR REPLACE FUNCTION resize(image bytea, h integer, w integer) | |
RETURNS bytea | |
LANGUAGE plpythonu | |
AS $function$ | |
if ('io' in SD) and ('StringIO' in SD) and ('Image' in SD): | |
io = SD['io'] | |
StringIO = SD['StringIO'] | |
Image = SD['Image'] | |
else: | |
import io, StringIO |
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
CREATE OR REPLACE FUNCTION crop(image bytea, rect box) | |
RETURNS bytea | |
LANGUAGE plpythonu | |
AS $function$ | |
if ('io' in SD) and ('StringIO' in SD) and ('Image' in SD): | |
io = SD['io'] | |
StringIO = SD['StringIO'] | |
Image = SD['Image'] | |
else: | |
import io, StringIO |
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
com -d "Delete duplicate tabs" tabcloseduplicates,tabclosed -js let seen={},vtabs=tabs.visibleTabs,i=vtabs.length;while(i--){let loc=vtabs[i].linkedBrowser.contentDocument.location.href||"";if(Object.prototype.hasOwnProperty.call(seen, loc)){config.tabbrowser.removeTab(vtabs[i]);}else{seen[loc]=true;}} | |
com -d "Delete duplicate tabs (including tabs with different view of the same page, i.e. pages with anchors)" tabcloseduplicatesanchors,tabcloseda -js let seen={},vtabs=tabs.visibleTabs,i=vtabs.length;while(i--){let loc=vtabs[i].linkedBrowser.contentDocument.location.href.replace(/#[^#]*$/, '')||"";if(Object.prototype.hasOwnProperty.call(seen, loc)){config.tabbrowser.removeTab(vtabs[i]);}else{seen[loc]=true;}} |
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
localhost:~ # salt-call state.sls cmd_fail -l debug | |
[DEBUG ] Reading configuration from /etc/salt/minion | |
[INFO ] Using cached minion ID from /etc/salt/minion_id: svk_server-vm | |
[DEBUG ] Configuration file path: /etc/salt/minion | |
[DEBUG ] Reading configuration from /etc/salt/minion | |
[DEBUG ] Loaded minion key: /etc/salt/pki/minion/minion.pem | |
[DEBUG ] Decrypting the current master AES key | |
[DEBUG ] Loaded minion key: /etc/salt/pki/minion/minion.pem | |
[DEBUG ] Loaded minion key: /etc/salt/pki/minion/minion.pem | |
[DEBUG ] Loaded localemod as virtual locale |
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
print('Hello,') | |
print('Привет,!') |
NewerOlder