This file contains 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
version: "3.4" | |
services: | |
deluge: | |
container_name: deluge | |
image: linuxserver/deluge:latest | |
restart: unless-stopped | |
environment: | |
- PUID=${PUID} # default user id, defined in .env | |
- PGID=${PGID} # default group id, defined in .env | |
- TZ=${TZ} # timezone, defined in .env |
This file contains 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 | |
# Wait for LAN to be available | |
while ! ping -c 1 192.168.0.1 >/dev/null; do | |
sleep 1 | |
done | |
# Change directory | |
cd Desktop/docker_radarr/ |
This file contains 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
function validateNif(nif){ | |
// validation reference: | |
// http://pt.wikipedia.org/wiki/N%C3%BAmero_de_identifica%C3%A7%C3%A3o_fiscal | |
var error=0; | |
if ( | |
nif.substr(0,1) != '1' && // pessoa singular | |
nif.substr(0,1) != '2' && // pessoa singular | |
nif.substr(0,1) != '3' && // pessoa singular | |
nif.substr(0,2) != '45' && // pessoa singular não residente |
This file contains 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
function formatBytes(bytes) { | |
var marker = 1024; // Change to 1000 if required | |
var decimal = 3; // Change as required | |
var kiloBytes = marker; // One Kilobyte is 1024 bytes | |
var megaBytes = marker * marker; // One MB is 1024 KB | |
var gigaBytes = marker * marker * marker; // One GB is 1024 MB | |
var teraBytes = marker * marker * marker * marker; // One TB is 1024 GB | |
// return bytes if less than a KB | |
if(bytes < kiloBytes) return bytes + " Bytes"; |
This file contains 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
/* | |
* sanitize HTML with jQuery based on whitelist | |
* example: | |
* sanitizer.sanitize('<a href="foo" class="bar">aaa</a><script>alert("...")</script>', {'a': ['href'], 'strong': []}) | |
* returns '<a href="foo">aaa</a>' | |
*/ | |
var sanitizer = {}; | |
(function($) { | |
function trimAttributes(node, allowedAttrs) { |
This file contains 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
public class PropertiesToConstantsGenerator { | |
public static void main(String[] args) throws IOException { | |
Properties properties = new Properties(); | |
InputStream inputStream =PropertiesToInterfaceGenerator.class.getClassLoader().getResourceAsStream("saf_en.properties"); | |
if(null != inputStream ){ | |
properties.load(inputStream); | |
} | |
generate(properties); | |
} |
This file contains 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 nome= userDao.getNomeCompleto(2L); | |
String nomeFiltered=""; | |
for (int i=0;i<str.length();i++) { | |
//only allows letters from ASCII value | |
if (str.charAt(i)>64 && str.charAt(i)<=122) { | |
nomeFiltered=nomeFiltered+str.charAt(i); | |
} | |
} |
This file contains 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
// validação email com mais segurança | |
$.validator.addMethod("completeemail", | |
function(value, element) { | |
return /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(value); | |
}, | |
"O endereço e-mail não é válido" | |
); |
This file contains 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 | |
# | |
# matrix: matrix-ish display for Bash terminal | |
# Author: Brett Terpstra 2012 <http://brettterpstra.com> | |
# Contributors: Lauri Ranta and Carl <http://blog.carlsensei.com/> | |
# | |
# A morning project. Could have been better, but I'm learning when to stop. | |
### Customization: | |
blue="\033[0;34m" |
This file contains 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
# No inicio.jsp | |
<input type="hidden" id="controloAlteracoes" value="0"> | |
# no acesso.js (chamado no inicio.jsp) | |
$("#controloAlteracoes").change(function () { | |
if ($(this).val() == 1) { | |
toastr.clear(); | |
toastr["info"]("Existem informações não guardadas", "Atenção", { | |
"closeButton": true, | |
"debug": false, |
NewerOlder