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 isLocal() { | |
| return (document.location.hostname=='localhost' || document.location.hostname=='127.0.0.1'); | |
| } |
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 print_r(theObj) { | |
| var out = ''; | |
| if(theObj.constructor == Array || | |
| theObj.constructor == Object){ | |
| out +="<ul>"; | |
| for(var p in theObj){ | |
| if(theObj[p].constructor == Array|| | |
| theObj[p].constructor == Object){ | |
| out +="<li>["+p+"] => "+typeof(theObj)+"</li>"; | |
| out +="<ul>"; |
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 minmaxrandom(min, max) //genera numero casuale compreso in un range di valori | |
| { | |
| return Math.random() * (max - min) + min; | |
| } |
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 rgb2hex(rgb) //converte da array di valori 0-255 e stringa esadecimale | |
| { | |
| 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); | |
| } | |
| return '#'+toHex(rgb[0])+toHex(rgb[1])+toHex(rgb[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
| function randcolorhue(rgb) { //generate random color with same colore tone | |
| var hsl = rgb2hsl(rgb); | |
| var newhsl = [ Math.min(hsl[0]*minmaxrandom(0.95,1.05),1), hsl[1]*minmaxrandom(0.7,1), Math.min(hsl[2]*minmaxrandom(0.8,1.2),1) ]; | |
| //stessa tonalita' | |
| return hsl2rgb(newhsl); | |
| } | |
| function minmaxrandom(min, max) //genera numero casuale compreso in un range di valori | |
| { | |
| return Math.random() * (max - min) + min; |
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 http_post_requestSock($url, $pdata=null, $getHeaders=false) | |
| { | |
| $urlinfo = parse_url($url); | |
| $port = isset($urlinfo["port"]) ? $urlinfo["port"] : 80; | |
| $pdata = is_array($pdata) ? http_build_query($pdata) : $pdata; | |
| $cookie = 'username=user; password=pass; path=/'; | |
| $reqH = "POST ".$urlinfo["path"]." HTTP/1.1\r\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
| xml2json={ | |
| parser:function(xmlcode,ignoretags,debug){ | |
| if(!ignoretags){ignoretags=""}; | |
| xmlcode=xmlcode.replace(/\s*\/>/g,'/>'); | |
| xmlcode=xmlcode.replace(/<\?[^>]*>/g,"").replace(/<\![^>]*>/g,""); | |
| if (!ignoretags.sort){ignoretags=ignoretags.split(",")}; | |
| var x=this.no_fast_endings(xmlcode); | |
| x=this.attris_to_tags(x); | |
| x=escape(x); |
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
| <? | |
| $p = popen('/usr/bin/top','r'); | |
| while(!feof($p)) | |
| { | |
| $r = fgets($p); | |
| if(strstr($r,'root'))//filter root process | |
| { | |
| passthru('clear'); |
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 | |
| #copyleft stefano.cudini@gmail.com | |
| # | |
| #requirements: | |
| #aptitude install pv lame speex mplayer | |
| #rename this file in testplayer and set permission 0755 | |
| #a sound file contains more human voice | |
| # | |
| #make test files: | |
| #lame --decode song.mp3 song.wav |
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
| cat bigfile.tar | pv -s 13M -rp -L 100k > gifile2.tar |