VestaCP update ip address
/usr/local/vesta/bin/v-update-sys-ip
30 марта 2017, 16:29
/usr/local/vesta/bin/v-update-sys-ip
cp $(brew --prefix mysql)/support-files/my-default.cnf /usr/local/etc/my.cnf
gpart show
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
if ($request_method = 'OPTIONS') { add_header 'Access-Control-Allow-Origin' "$http_origin"; add_header 'Access-Control-Allow-Credentials' 'true'; add_header 'Access-Control-Allow-Methods' 'GET, POST,PUT,DELETE,OPTIONS'; add_header 'Access-Control-Allow-Headers' 'Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Origin,Accept'; add_header 'Content-Type' 'application/json'; add_header 'Content-Length' 0; return 204; }
App::instance('var', $var); $var = \App::make('var');
#!/bin/bash # Delete all containers docker rm $(docker ps -a -q) # Delete all images docker rmi $(docker images -q) docker system prune # Delete all volumes docker volume prune
echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf sysctl vm.overcommit_memory=1
external_url 'http://gitlab.example.com/'
sudo gitlab-ctl reconfigure sudo gitlab-ctl restart
<?php $token = '**************************************'; $group_id = '1111111'; $vk = new Vk($token); $image_path = 'image.png'; copy('https://www.google.ru/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png', 'image.png'); $upload_server = $vk->photosGetWallUploadServer($group_id); $upload = $vk->uploadFile($upload_server['upload_url'], $image_path); $save = $vk->photosSaveWallPhoto([ 'group_id' => $group_id, 'photo' => $upload['photo'], 'server' => $upload['server'], 'hash' => $upload['hash'] ] ); $attachments = sprintf('photo%s_%s', $save[0]['owner_id'], $save[0]['id']); $post = $vk->wallPost([ 'owner_id' => "-$group_id", 'from_group' => 1, 'message' => "блаблабла", 'attachments' => $attachments ]); class Vk { private $token; private $v = '5.37'; public function __construct($token) { $this->token = $token; } public function wallPost($data) { return $this->request('wall.post', $data); } public function photosGetWallUploadServer($group_id) { $params = [ 'group_id' => $group_id, ]; return $this->request('photos.getWallUploadServer', $params); } /** * @param $params [user_id, group_id, photo, server, hash] * @return mixed * @throws \Exception */ public function photosSaveWallPhoto($params) { return $this->request('photos.saveWallPhoto', $params); } public function uploadFile($url, $path) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POST, true); if (class_exists('\CURLFile')) { curl_setopt($ch, CURLOPT_POSTFIELDS, ['file1' => new \CURLFile($path)]); } else { curl_setopt($ch, CURLOPT_POSTFIELDS, ['file1' => "@$path"]); } $data = curl_exec($ch); curl_close($ch); return json_decode($data, true); } private function request($method, array $params) { $params['v'] = $this->v; $ch = curl_init('https://api.vk.com/method/' . $method . '?access_token=' . $this->token); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $params); $data = curl_exec($ch); curl_close($ch); $json = json_decode($data, true); if (!isset($json['response'])) { throw new \Exception($data); } usleep(mt_rand(1000000, 2000000)); return $json['response']; } }
ffmpeg -i input_file.mp4 -vcodec copy -an output_file.mp4
curl --user USER:PASSWORD -T "/path/to/file" https://webdav.yandex.ru/
sockstat -4 -l | grep :80
dd_rescue -v -l /var/log/mfid1_error.log -o /var/log/mfid1_bad.log /dev/mfid1 /dev/null
cat /var/run/dmesg.bootВывод будет примерно такой
da18 at twa1 bus 0 scbus1 target 6 lun 0 da18: <AMCC 9650SE-12M DISK 4.10> Fixed Direct Access SCSI-5 device da18: Serial Number W1E1T3RX000000000000 da18: 100.000MB/s transfers da18: 1907729MB (3907029168 512 byte sectors: 255H 63S/T 243201C)
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