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
| <?php | |
| $file = $_SERVER['QUERY_STRING']; | |
| header("Content-length: ".filesize($file)); | |
| header("Content-type: ".mime_content_type($file)); | |
| readfileLimit($file); | |
| function readfileLimit($file, $limit='20k') |
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 | |
| line=$(grep $1 $2 -n | cut -d':' -f1) | |
| nano +$line $2 |
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 | |
| chains=$(iptables -L | grep "Chain fail2ban" | cut -d' ' -f2) | |
| for chain in $chains | |
| do | |
| iptables -D $chain -s $1 -j DROP | |
| done |
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
| $('input:text').focus() | |
| .on('keyup',function(e) { | |
| var hovertag$ = tool$.children('.hover'); | |
| switch(e.keyCode) | |
| { | |
| case 38: //freccia su | |
| hovertag$.removeClass('hover').prev('a').addClass('hover'); | |
| break; |
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
| $.extend($.expr[':'], { //definizione di :conaints() case insesitive | |
| 'containsi': function(elem, i, match, array) | |
| { | |
| return (elem.textContent || elem.innerText || '').toLowerCase() | |
| .indexOf((match[3] || "").toLowerCase()) >= 0; | |
| } | |
| }); | |
| //example | |
| $("a:containsi('text')"); |
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
| /* | |
| <label class="count" id="countresults">Results<em></em></label> | |
| <input id="findres" type="text" size="8" value="" /> | |
| <div id="actives"> | |
| <div id="activesempty">Nessun elemento trovato.</div> | |
| </div> | |
| */ | |
| $(function() { | |
| $('#findres').finder({ |
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
| function createSelection(start, end, field) { | |
| if ( field.createTextRange ) { | |
| /* | |
| IE calculates the end of selection range based | |
| from the starting point. | |
| Other browsers will calculate end of selection from | |
| the beginning of given text node. | |
| */ |
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
| var start = new Date().getMilliseconds(); | |
| //operations | |
| var end = new Date().getMilliseconds(); | |
| var diff = end - start; | |
| console.log(diff); |
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
| function track_randcolor() //restituisce un array con valori RGB 0-255 | |
| { | |
| function toHex(n) { | |
| n = parseInt(n,10); | |
| if (isNaN(n)) return "00"; | |
| n = Math.max(0,Math.min(n,255)); | |
| return "0123456789ABCDEF".charAt((n-n%16)/16) + | |
| "0123456789ABCDEF".charAt(n%16); | |
| } | |
| function rgb2hex(rgb) { //converte da array di valori 0-255 e stringa esadecimale |
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
| <? | |
| function xml2array($xml) | |
| { | |
| return (empty($xml) ? array() : json_decode(json_encode(simplexml_load_string($xml)),true) ); | |
| } | |
| ?> |