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 | |
$maxN = 10; | |
$maxE = 20; | |
// generate random edges | |
$e = []; | |
for($n = 1; $n <= $maxE; $n++) { | |
$e[] = [rand(1, $maxN), rand(1, $maxN)]; | |
} |
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 | |
$templine = `sensors | grep "temp1"`; | |
//echo $templine . "\n"; | |
if (preg_match('/\+(\d+\.\d+)/', $templine, $matches)) { | |
$temp = (float) $matches[1]; | |
//echo $temp; | |
if ($temp > 85) { | |
`beep -f 2400 -r 3`; |
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 | |
define('PI', 3.1415); | |
if (!defined('MY_CONSTANT')) { | |
define('MY_CONSTANT', 42); | |
} | |
echo MY_CONSTANT; // 42 |
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
// using the KP_* keys here to emulate behavior | |
// otherwise this will result in an endless loop | |
"xdotool key KP_Home" | |
Release+Prior | |
"xdotool key KP_End" | |
Release+Next | |
"xdotool key KP_Prior" | |
Release+Home | |
"xdotool key KP_Next" | |
Release+End |
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 | |
/** | |
* | |
* | |
* @author Carsten Brandt <[email protected]> | |
*/ | |
namespace yii\db; | |
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 | |
class YiiBase | |
{ | |
public static $app; | |
public static function test() | |
{ | |
echo self::$app; | |
} |
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 | |
function fun($a = 'a', $b = 'b', $c = 'c') | |
{ | |
echo $a . $b . $c; | |
} | |
fun($b = 'd'); | |
// does output: dbc |
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 | |
trait BehaviorA | |
{ | |
public function handleExampleEvent() | |
{ | |
// do something | |
} | |
} |
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
# /etc/postfix/main.cf | |
## uncomment these when relaying via mail provider | |
## the host to relay via. The brackets mean "take the hostname itself, not its MX" | |
#relayhost = [mala.cebe.net] | |
## a fallback host to use if relayhost is not available | |
#smtp_fallback_relay= [hermes.bh-servers.net] | |
## uncommend these when you need smtp auth for mail provider | |
## put the following line in /etc/postfix/relay_password: |
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
protected/controllers/EmailController.php | |
<?php | |
// no namespace needed here | |
class EmailController extends controller{ | |
public function actionSend(){ | |
$recipient = new \application\documents\email\Recipient(); | |
} |