27 Juni 2012

 

Zararadio Heavy rotations

define("DEBUG", 1);
define("DIR", "D:/zararadio/");
define("DIR_CONF", DIR."bin/");
define("DIR_TPL", DIR."template/");
define("DIR_SEQ", DIR."sequences/");
define("DIR_PLS", DIR."playlist/");
define("DIR_VOC", DIR."voice/");
define("DIR_ADS", DIR."ads/");
define("DIR_ADS", DIR."text/");
define("DIR_AUTO", DIR."auto/");

$whari = array( "minggu", "senin", "selasa", "rabu", "kamis", "jumat", "sabtu");
$hh = $whari[date("w",time())];
$jj = date("H",time());
$mmdd = date("m-d",time());

// what to queries

$q0 = "*:*";
$q1 = "$hh:*";
$q2 = "*:$jj";
$q3 = "$hh:$jj";

if ($jj < 6) { $q4= "subuh"; }
if (($jj >= 6) & ($jj < 10))   { $q4= "pagi"; }
if (($jj >= 10) & ($jj < 14))  { $q4= "siang"; }
if (($jj >= 14) & ($jj < 18))  { $q4= "sore"; }
if (($jj >= 18) & ($jj <= 23)) { $q4= "malam"; }

$q5 = "$mmdd:*";
$q6 = "$mmdd:$jj";

$object = array (
 "ads0" => DIR_ADS,
 "ads1" => DIR_ADS,
 "ads2" => DIR_ADS,
 "ads3" => DIR_ADS,
 "ads4" => DIR_ADS,
 "pls0" => DIR_PLS,  
 "pls1" => DIR_PLS,  
 "pls2" => DIR_PLS,  
 "pls3" => DIR_PLS,  
 "pls4" => DIR_PLS,  
 "seq0" => DIR_SEQ,  
 "seq1" => DIR_SEQ,  
 "seq2" => DIR_SEQ,
 "seq3" => DIR_SEQ,
 "seq4" => DIR_SEQ,
 "voc-talk"  => DIR_VOC,
 "voc-open" => DIR_VOC,
 "voc-close" => DIR_VOC,
 "text" => DIR_TXT,
 "lock" => ""
);

function pre_check($f,$o) {
 global $object;
 $ext = array ("lst","mp3","rot","seq");
 if ($f) {
 foreach ($ext as $e) {
  $fi = $object[$o]."$f.$e";
  if (file_exists($fi)) { 
   $fc=$fi; 
  } 
 }
 return $fc;
 }
}

function make_values($I) {
 global $object, $q0, $q1, $q2, $q3, $q4, $q5, $q6;
 $values = array();
 // Main function, make variable
 foreach (array_keys($object) as $o) {
        $values["$$o"] = pre_check($I["$q6"][$o],$o); /* 12-25:jam */
        if (is_null ($values["$$o"])) { $values["$$o"] = pre_check($I["$q5"][$o],$o); } /* 12-25:* */
        if (is_null ($values["$$o"])) { $values["$$o"] = pre_check($I["$q3"][$o],$o); } /* full */
        if (is_null ($values["$$o"])) { $values["$$o"] = pre_check($I["$q2"][$o],$o); } /* jam */
        if (is_null ($values["$$o"])) { $values["$$o"] = pre_check($I["$q1"][$o],$o); } /* hari */
        if (is_null ($values["$$o"])) { $values["$$o"] = pre_check($I["$q4"][$o],$o); } /* siang/sore */
        if (is_null ($values["$$o"])) { $values["$$o"] = pre_check($I["$q0"][$o],$o); } /* default values */
 }
 return $values;
}

// Load configurations

$values = make_values(parse_ini_file(DIR_CONF."claudio.ini",true));
if (DEBUG) { print_r($values);  }


$template = array (
 "open.lst","close.lst","restart.lst",
 "apc.seq","auto1.lst","auto2.lst","auto3.lst",
 "ts1.seq","ts2.seq","ts3.seq",
);

function parse_template($temp) {
 global $object, $q0, $q1, $q2, $q3, $q4, $q5, $q6, $values;
 foreach (array_keys($object) as $o) {
        if ($values["$$o"]) { $temp = preg_replace("/%".$o."%/i", "-1\t".$values["$$o"], $temp); } 
  else { $temp = preg_replace("/%".$o."%/i", "", $temp); }
 }
 $temp = preg_replace("/^-1\t*[\n|\r]/", "", $temp);
 $temp = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $temp);
 $temp = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "", $temp);
 $temp = preg_replace("/\//","\\",$temp); /* win32 slash */
 // count
 $c = explode("\n",$temp); $counter = count($c)-1;
 $finetemp = $counter . "\n" .$temp;
 return $finetemp;
}

foreach ($template as $tpl) {
  $temp = "";
  if (file_exists(DIR_TPL.$tpl)) {
  $T = file(DIR_TPL.$tpl); $temp = implode ($T); $temp = $temp."\n";
  $temp = parse_template($temp);
  if ($temp) { echo "$tpl\n\n$temp\n---------------\n"; }
 }
}

// Unfinished: Write $temp to new files
// 

Label: ,


 

freegamesforyourwebsite.com repository alike

freegamesforyourwebsite.com repository scripts
#!/bin/bash
PACK=$1
#
#usage syntax : fog [game-id]
#
REPOS="/var/www/fog/.repos"
wget -c http://www.freegamesforyourwebsite.com/download.php?g=$PACK -O $REPOS/$PACK.zip
unzip -j $REPOS/$PACK.zip -d /var/www/fog/$PACK
chown myfog:myfog /var/www/fog/$PACK -R

Label: , ,


08 Juli 2011

 

Mikrotik netwatch routine using global vars

:global wan0Stat
:global wan1Stat
:global wan0LastStat
:global wan1LastStat
:global LastUseBalance

/global UseBalance false
/log info "[+] Netstatus-routine"

:if ($wan0Stat = "UP" and $wan0LastStat="DOWN") do={
 /system script run set-wan0-up
}
:if ($wan0Stat = "DOWN") do={
 /system script run set-wan0-down
}

:if ($wan1Stat = "UP" and $wan1LastStat="DOWN") do={
 /system script run set-wan1-up
}
:if ($wan1Stat = "DOWN") do={
 /system script run set-wan1-down
}

:if ($wan0Stat = "UP" and $wan1Stat = "UP") do={ /global UseBalance true }

:if ($UseBalance = true and $LastUseBalance = false) do={
 /system script run nthbalance-up
} 
:if ($UseBalance=false) do={
 /system script run nthbalance-down
}

/log info "NetStatus | wan0: $wan0Stat"
/log info "NetStatus | wan1: $wan1Stat"
/log info "NetStatus | UseBalance: $UseBalance"

Label:


04 Februari 2011

 

Dynamic video player frame size

var sw=$(window).width();
var sh=$(window).height();
var sm = sw*0.02;
var pw = sw-sm; // add more variable to make it fit
var pr = 9/16; // 16:9 - video size
var pp = 16; // holder padding

// Player-holder size 
$('#player-holder').width(pw);
$('#player-holder').height(pr*pw);
$('#player-holder').css('padding',pp);

// Player size 
$('#player').width(pw-(2*pp));
$('#player').height((pr*pw)-(2*pp));

Label:


15 Januari 2011

 

No cache!

html meta

http-equiv='cache-control' content='no-cache'
http-equiv='expires' content='-1'
http-equiv='pragma' content='no-cache'

JQuery

$.ajaxSetup({cache: false});

.htaccess


ExpiresDefault A0
Header set cache-control: "no-cache, no-store,public, must-revalidate"


Label: , ,


 

My reset.css

My Reset CSS with commonly used
html,body,div,span,object,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,samp,small,strong,sub,sup,tt,var,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;vertical-align:baseline;outline:none;font-size:100%;background:transparent;border:none;text-decoration:none}
b,i,hr,u,center,menu,layer,s,strike,font,xmp{margin:0;padding:0;vertical-align:baseline;outline:none;font-size:100%;font-weight:normal;font-style:normal;background:transparent;border:none;text-decoration:none}

html{height:100%;margin-bottom:0.1em;overflow-y:scroll}
* html{overflow-x:hidden}
body {font-size:13px;line-height: 18px;}
h1{font-size:2em}
h2{font-size:1.75em}
h3{font-size:1.5em}
h4{font-size:1.25em}
h5{font-size:1em}
h6{font-size:.75em}
h1,h2,h3,h4,h5,h6{margin:1em 0 .5em}
table { border-collapse: collapse }
.pos{position:absolute}
.fix{position:fixed}
.rel{position:relative}
.click{cursor:pointer}
.help{cursor:help}
.hide,.old-version{display:none !important}
.show{display:block !important}
.clear,.clr{clear:both}
.noborder{border:none !important}
.right{float:right}
.left{float:left}

.geo,.georgia{font-family:Georgia, "Times New Roman", Times, serif !important}
.ver,.verdana{font-family:Verdana, Arial, Helvetica, sans-serif !important}
.tah,.tahoma{font-family:Tahoma, Arial, Helvetica, sans-serif !important}
.tim,.times{font-family:"Times New Roman", Times, serif !important}
.tre,.trebuchet{font-family:"Trebuchet MS", Arial, Helvetica, cursive !important}
.cou,.courier{font-family:"Courier New", Courier, monospace !important}
.ari,.arial{font-family:Arial, Helvetica, sans-serif !important}
.luc,.lucida{font-family:"Lucida Sans", "Lucida Sans Unicode", "Lucida Grande", Arial, Hevletica, sans-serif !important}

.topnavbar{display:block}
.topnavbar li {list-style-type:none;}
.topnavbar li a { display: block }
.topnavbar > li{float:left;margin-right:24px;}
.topnavbar > li:last-child{margin-right:0}

.show{display:block}
.clear,.clr{clear:both}

.ui-corner-tl{-moz-border-radius-topleft:5px;-webkit-border-top-left-radius:5px;}
.ui-corner-tr{-moz-border-radius-topright:5px;-webkit-border-top-right-radius:5px;}
.ui-corner-bl{-moz-border-radius-bottomleft:5px;-webkit-border-bottom-left-radius:5px;}
.ui-corner-br{-moz-border-radius-bottomright:5px;-webkit-border-bottom-right-radius:5px;}
.ui-corner-top{-moz-border-radius-topleft:5px;-webkit-border-top-left-radius:5px;-moz-border-radius-topright:5px;-webkit-border-top-right-radius:5px;}
.ui-corner-bottom{-moz-border-radius-bottomleft:5px;-webkit-border-bottom-left-radius:5px;-moz-border-radius-bottomright:5px;-webkit-border-bottom-right-radius:5px;}
.ui-corner-right{-moz-border-radius-topright:5px;-webkit-border-top-right-radius:5px;-moz-border-radius-bottomright:5px;-webkit-border-bottom-right-radius:5px;}
.ui-corner-left{-moz-border-radius-topleft:5px;-webkit-border-top-left-radius:5px;-moz-border-radius-bottomleft:5px;-webkit-border-bottom-left-radius:5px;}
.ui-corner-all{-moz-border-radius:5px;-webkit-border-radius:5px;}

.input-checkbox,input[type=checkbox] { vertical-align: -15% }
.input-radio,input[type=radio] { vertical-align: -15% }

Label: ,


 

JQuery: Yahoo API: Weather Updates

Download and documentation: http://www.zazar.net/developers/zweatherfeed/

My script:



Label: ,


Arsip

Januari 2009   Oktober 2009   November 2009   Maret 2010   Januari 2011   Februari 2011   Juli 2011   Juni 2012