Firewall on iptables
iptables -A INPUT -i eth0 -p tcp --dport 22 -j ACCEPT iptables -A INPUT -i eth0 -p udp --dport 80 -j ACCEPT iptables -A INPUT -i eth0 -p udp --dport 443 -j ACCEPT iptables -A INPUT -i eth0 -j DROP
26 апреля 2016, 10:19
iptables -A INPUT -i eth0 -p tcp --dport 22 -j ACCEPT iptables -A INPUT -i eth0 -p udp --dport 80 -j ACCEPT iptables -A INPUT -i eth0 -p udp --dport 443 -j ACCEPT iptables -A INPUT -i eth0 -j DROP
.directive('useFormData', function ($parse) {
return {
link: function (scope, element, attrs) {
if (attrs.ngModel && attrs.value) {
$parse(attrs.ngModel).assign(scope, attrs.value);
}
}
};
});
<input type="text" ng-model="title" value="default value" use-form-data />
Для textarea
.directive('useFormData', function ($parse) {
return {
link: function (scope, element, attrs) {
if (attrs.ngModel && element[0].defaultValue) {
$parse(attrs.ngModel).assign(scope, element[0].defaultValue);
}
}
};
});
<?php
$result = (new \MessageFormatter('ru-RU', '{n, spellout}'))->format(['n' => 321]);
echo $result; // триста двадцать один
$result = (new \MessageFormatter('ru-RU', '{n, spellout,%spellout-cardinal-feminine}'))->format(['n' => 321]);
echo $result; // триста двадцать одна
ssh -fN -L 6666:localhost:27017 user@hostТеперь можно подключаться к удаленной базе через 127.0.0.1 по порту 6666
sudo apt-get install openjdk* sudo apt-get install icedtea-plugin
DELETE b FROM tbl
LEFT JOIN rel ON rel.id = tbl.fileid
WHERE rel.id IS NULL
2. NOT EXISTS
DELETE FROM tbl
WHERE NOT EXISTS(SELECT NULL
FROM rel
WHERE rel.id = tbl.fileid)
3. NOT IN
DELETE FROM tbl
WHERE tbl.fileid NOT IN (SELECT rel.id
FROM rel)
/showplaces показывает с каких устройств вы подключены /remotelogout выход со всех устройств кроме текущего (push уведомления тоже отключаются)
libfdk_aac > libfaac > libvo_aacenc
pkg install pecl-intl
<?php
$formatter = new IntlDateFormatter('ru_RU', IntlDateFormatter::FULL, IntlDateFormatter::FULL);
$formatter->setPattern('d MMMM YYYY, HH:mm');
echo $formatter->format(new DateTime('2015-01-01 01:01:01')); //1 января 2015, 01:01
# flash bios MegaCli -adpfwflash -f /scripts/firmware/lsi_imr_fw.rom -aALL MegaCli -adpfwflash -f imr_fw.rom -NoVerChk -aAll MegaCli -adpfacdefset -aALL # reset to factory default # controller info MegaCli -AdpAllinfo -aALL MegaCli -PDGetNum -a0 # nubmer of discs MegaCli -PDInfo -PhysDrv [64:0] -aALL MegaCli -PDMakeJBOD -PhysDrv[64:4] # clear controller config to defaults MegaCli -CfgClr -aALL # delete all MegaCli -CfgLdDel -LALL -aALL # create raid MegaCli -CfgLdAdd -r5 [64:0, 64:1, 64:2, 64:3] -a0 MegaCli -CfgLdAdd -r0 [64:4,64:5,64:6,64:7] -a0 # get free devices MegaCli -PDList -a0 | grep -e '^Enclosure Device ID:' -e '^Slot Number:' # get raid info MegaCli -LDInfo -Lall -aALL MegaCli -PDMakeGood -PhysDrv[64:4] -force -aALL > /dev/null MegaCli -PDMakeGood -PhysDrv[64:5] -force -aALL > /dev/null MegaCli -PDMakeGood -PhysDrv[64:6] -force -aALL > /dev/null MegaCli -PDMakeGood -PhysDrv[64:7] -force -aALL > /dev/null MegaCli -PDMakeJBOD -PhysDrv[64:4,64:5,64:6,64:7] -a0 MegaCli -CfgLdAdd -r0 [64:4,64:5,64:6,64:7] -a0 MegaCli -AdpEventLog -GetEvents -f logfile -aALL # Dump all events from the adapters event log to a file named logfile MegaCli -PDList -aAll # Dump information about all Phsyical Disks MegaCli -LDInfo -LAll -aAll # Dump information about all Logical Disks on all adapters MegaCli -LdPdInfo -aAll # Dump information of all logical and physical disks on all known adapters MegaCli -AdpSetProp -EnableJBOD 1 -aALL MegaCli -CfgDsply -aAll # adapter diagnostic MegaCli -AdpDiag -a0 Controller information MegaCli -AdpAllInfo -aALL MegaCli -CfgDsply -aALL MegaCli -AdpEventLog -GetEvents -f events.log -aALL && cat events.log Enclosure information MegaCli -EncInfo -aALL Virtual drive information MegaCli -LDInfo -Lall -aALL Physical drive information MegaCli -PDList -aALL MegaCli -PDInfo -PhysDrv [E:S] -aALL Battery backup information MegaCli -AdpBbuCmd -aALL Controller management Silence active alarm MegaCli -AdpSetProp AlarmSilence -aALL Disable alarm MegaCli -AdpSetProp AlarmDsbl -aALL Enable alarm MegaCli -AdpSetProp AlarmEnbl -aALL Physical drive management Set state to offline MegaCli -PDOffline -PhysDrv [E:S] -aN Set state to online MegaCli -PDOnline -PhysDrv [E:S] -aN Mark as missing MegaCli -PDMarkMissing -PhysDrv [E:S] -aN Prepare for removal MegaCli -PdPrpRmv -PhysDrv [E:S] -aN Replace missing drive MegaCli -PdReplaceMissing -PhysDrv [E:S] -ArrayN -rowN -aN Rebuild drive MegaCli -PDRbld -Start -PhysDrv [E:S] -aN MegaCli -PDRbld -Stop -PhysDrv [E:S] -aN MegaCli -PDRbld -ShowProg -PhysDrv [E:S] -aN Clear drive MegaCli -PDClear -Start -PhysDrv [E:S] -aN MegaCli -PDClear -Stop -PhysDrv [E:S] -aN MegaCli -PDClear -ShowProg -PhysDrv [E:S] -aN MegaCli -PDMakeGood -PhysDrv[E:S] -aN This changes drive in state Unconfigured-Bad to Unconfigured-Good. Set the drive offline, if it is not already offline due to an error MegaCli -PDOffline -PhysDrv [E:S] -aN Mark the drive as missing MegaCli -PDMarkMissing -PhysDrv [E:S] -aN Prepare drive for removal MegaCli -PDPrpRmv -PhysDrv [E:S] -aN If you’re using hot spares then the replaced drive should become your new hot spare drive: MegaCli -PDHSP -Set -PhysDrv [E:S] -aN In case you’re not working with hot spares, you must re-add the new drive to your RAID virtual drive and start the rebuilding MegaCli -PdReplaceMissing -PhysDrv [E:S] -ArrayN -rowN -aN MegaCli -PDRbld -Start -PhysDrv [E:S] -aN MegaCli -CfgLdAdd -r0 [0:1, 0:1] -a0 MegaCli -LDInfo -Lall -aALL # View all controleler informations MegaCli -AdpAllInfo -aAll MegaCli -LDSetProp CachedBadBBU -LALL -aALL Delete all devices MegaCli -CfgLdDel -LALL -aALL MegaCli -CfgLdAdd -r1 [252:0,252:1] -a0 MegaCli -CfgLdAdd -r10 [252:0,252:1,252:2,252:3] -a0 # create RAID5 MegaCli -CfgLdAdd -r5 [64:0,64:1,64:2,64:3] -a0 # create RAID10 MegaCli -CfgSpanAdd -r10 -Array0[64:0,64:1] -Array1[64:2,64:3] -a0 # create RAID10 MegaCli -AdpSetProp -EnableJBOD 1 # Enable disks cache MegaCli -LDSetProp EnDskCache -LAll -aAll # Force flash MegaCli -adpfwflash -f ./12.12.0-0111.rom -NoVerChk -a0 # load controller defauts MegaCli -adpfacdefset -aALL
Ctrl+a c Create new window Ctrl+a k Kill the current window / session Ctrl+a w List all windows Ctrl+a 0-9 Go to a window numbered 0 9, use Ctrl+a w to see number Ctrl+a Ctrl+a Toggle / switch between the current and previous window Ctrl+a S Split terminal horizontally into regions and press Ctrl+a c to create new window there Ctrl+a :resize Resize region Ctrl+a :fit Fit screen size to new terminal size. You can also hit Ctrl+a F for the the same task Ctrl+a :remove Remove / delete region. You can also hit Ctrl+a X for the same taks Ctrl+a tab Move to next region Ctrl+a D (Shift-d) Power detach and logout Ctrl+a d Detach but keep shell window open Ctrl-a Ctrl-\ Quit screen Ctrl-a ? Display help screen i.e. display a list of commands
<script type="application/json" id="json">{"json_data":"here"}</script>
<script>
$(function(){
var json = JSON.parse($('#json').text());
});
</script>
firewall_enable="YES" firewall_quiet="YES" firewall_type="workstation" firewall_myservices="22 80 443" firewall_allowservices="any" firewall_logdeny="NO"Запускаем
sudo service ipfw start
{
"require": {
"jonnyw/php-phantomjs": "3.*",
"symfony/dom-crawler": "3.*",
"symfony/css-selector": "3.*"
},
"config": {
"bin-dir": "bin"
},
"scripts": {
"post-install-cmd": [
"PhantomInstaller\\Installer::installPhantomJS"
],
"post-update-cmd": [
"PhantomInstaller\\Installer::installPhantomJS"
]
}
}
Скачаем все зависимости
php composer.phar installНу и сам парсинг index.php
<?php
require __DIR__ . '/vendor/autoload.php';
$client = \JonnyW\PhantomJs\Client::getInstance();
$request = $client->getMessageFactory()->createRequest('http://superdeals.aliexpress.com/en?spm=2114.11010108.21.1.v65LIL', 'GET');
$response = $client->getMessageFactory()->createResponse();
$client->send($request, $response);
$html = $response->getContent();
$crawler = new \Symfony\Component\DomCrawler\Crawler($html);
$div = $crawler->filter('div.pro-msg');
if($div) {
echo $div->first()->text();
}
Если выполнить php index.php можно увидеть, что фантом скачал страницу и выполнил javascript код
Today Only
Boy's Coat
> Synthetic leather> Motor jacket style> Available in black and red
share:
vk
pinterest
facebook
Twinner
Google+
Email
Sign in and share the website for a chance to get Points, which you can then convert to coupons.
US $9.74
US $32.48 / piece | 70% Off
0486Left
Buy Now
netstat -tunlp | grep 8080
<?php
function getRows($file) {
$handle = fopen($file, 'rb');
if ($handle === false) {
throw new Exception();
}
while (feof($handle) === false) {
yield fgetcsv($handle);
}
fclose($handle);
}
foreach (getRows('data.csv') as $row) {
print_r($row);
}