Life Is Good


  • Home

  • Archives

群晖

Posted on 2021-07-01

Swoole

Posted on 2021-06-04

TCP面向对象

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
//服务端
class TCP
{
private $server = null;

public function __construct()
{
//创建Server对象,监听 127.0.0.1:9501 端口
$this->server = new Swoole\Server('127.0.0.1', 9501);

$this->server->set([
'worker_num' => 4,
'max_request' => 50,
]);

$this->server->on('Connect', [$this, "onConnect"]);
$this->server->on('Receive', [$this, "onReceive"]);
$this->server->on('Close', [$this, "onClose"]);
$this->server->start();
}

//监听连接进入事件
public function onConnect($server, $fd)
{
echo "客户端id:" . $fd . "连接.\n";
}
//监听数据接收事件
public function onReceive($server, $fd, $reactor_id, $data)
{
$server->send($fd, "发送的数据: {$data}");
}
//监听连接关闭事件
public function onClose($server, $fd){
echo "客户端id:" . $fd . "关闭.\n";
}


}


new TCP();

?>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
//客服端
use Swoole\Coroutine\Client;
use function Swoole\Coroutine\run;

go(function () {
$client = new Client(SWOOLE_SOCK_TCP);
if (!$client->connect('127.0.0.1', 9501, 0.5))
{
echo "connect failed. Error: {$client->errCode}\n";
}
fwrite(STDOUT,'请输入:');
$res=fgets(STDIN);
$client->send($res."\n");
echo $client->recv();
$client->close();
});
?>

网络安全

Posted on 2021-03-11

CDN SSL 安全狗 云锁 公安部中小网站防护系统 waf防火墙 G01

Javascript

Posted on 2020-12-23

常用JS

  • [jquery.SuperSlide]: http://www.superslide2.com/

  • jquery.tab.js

  • jQuery Validate

  • TouchSlide

  • Lightbox

  • http://www.swiper.com.cn/

  • validform.js

  • 前端网址导航 http://www.h-ui.net/site.shtml

  • jquery.fancybox

  • vue https://cn.vuejs.org

  • jQuery瀑布流插件masonry

  • JQuery插件supersized.js实现背景图片淡入浅出

  • 前端必备插件之纯原生JS的瀑布流插件Macy.js

  • jquery.form.js 表单的ajax提交

  • jquery.lazyload.js 图片的延迟加载

  • jQuery.validate.js 表单验证插件

  • 打字机效果https://github.com/mattboldt/typed.js/

  • H-ui 前端框架 http://www.h-ui.net/index.shtml

  • ADMINLTE https://adminlte.io/

  • ace_admin http://ace.jeka.by/

  • layuicms http://layuicms.com/

  • X-admin

  • beyondadmin

  • http://layer.layui.com/

  • metisMenu

  • 字体库和CSS框架 https://fontawesome.dashgame.com/

  • flowplayer jwplayer ckplayer dplayer http://dplayer.js.org/

  • Aos.js

  • zTree http://www.treejs.cn/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&amp;ak=71Vco0Yx0zd5szFS9b5HfYAZ"></script>
<script>
var map=new BMap.Map("map");
var point=new BMap.Point(114.139093,32.133128);
map.centerAndZoom(point,17);
map.enableScrollWheelZoom(); //开始滚轮控制。
map.addControl(new BMap.NavigationControl()); //控件
var marker1=new BMap.Marker(point); //创建标注
map.addOverlay(marker1);
marker1.addEventListener("mouseover",function(){
map.openInfoWindow(infoWindow,marker1.getPosition());
});
marker1.addEventListener("mouseout",function(){
map.closeInfoWindow(infoWindow,marker1.getPosition());
});
//alert(map.getCenter(116.404,39.915))
var opts1={
width:250,
height:100,
title:"<a style='color:#666;'>电话:010-6666666<br>地址:#</a>"
};
var infoWindow=new BMap.InfoWindow("#",opts1);
map.openInfoWindow(infoWindow,marker1.getPosition());
</script>
<div class="map" id="map" ></div>

.dh{ display:inline-block;-webkit-animation:zooming 1s infinite; -moz-animation:zooming 1s infinite; -o-animation:zooming 1s infinite; animation:zooming 1s infinite;}
@keyframes zooming{
    0%      {transform: scale(.8);} 
    50%     {transform: scale(1.05); text-shadow:0 0 5px white;}
    100%    {transform: scale(.8);}
}
@-webkit-keyframes zooming{
     0%      {-webkit-transform: scale(.8);} 
     50%     {-webkit-transform: scale(1.05); text-shadow:0 0 5px white; }
     100%    {-webkit-transform: scale(.8);}}
@-moz-keyframes zooming{
     0%      {-moz-transform: scale(.8);} 
     50%     {-moz-transform: scale(1.05); text-shadow:0 0 5px white; }
     100%    {-moz-transform: scale(.8);}}

@-o-keyframes zooming{
    0%      {-o-transform: scale(.8);} 
    50%     {-o-transform: scale(1.05); text-shadow:0 0 5px white;}
    100%    {-o-transform: scale(.8);}}

​

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25


<a href="#" class="class_outer"> <img src="1.jpg" width="546" height="353" border="0" /> <span class="class_cover">亲,透明遮罩会了吗?</span> </a>

.class_outer {
display: block;
width: 546px;
height: 276px;
margin: 10px auto;
position: relative;
overflow: hidden;
}
.class_cover {
width: 100%;
height: 50px;
line-height: 50px;
padding-left: 5px;
background-color: rgba(0, 0, 0, .50);
color: #FFFFFF;
font-size: 26px;
position: absolute;
left: 0px;
bottom: 0px;
}

需要加载jquery

1
2
3
4
5
6
7
8
9
10
11
12
 #back-top {
position: fixed;
width: 60px;
height: 60px;
bottom: 30px;
right: 30px;
background: #FF9C01;
color: #fff;
text-align: center;
line-height: 60px;
text-decoration: none;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27


$(function () {

//先将#back-top隐藏
$('#back-top').hide();

//当滚动条的垂直位置距顶部100像素一下时,跳转链接出现,否则消失
$(window).scroll(function () {
if ($(window).scrollTop() > 100) {
$('#back-top').fadeIn(1000);
} else {
$("#back-top").fadeOut(1000);
}
});

//点击跳转链接,滚动条跳到0的位置,页面移动速度是1000
$("#back-top").click(function () {

$('body,html').animate({
scrollTop: '0'
}, 1000);
return false; //防止默认事件行为
})

});

Linux

Posted on 2020-12-17

Linux

  • 排除断网

    1
    2
    3
    4
    ip a
    ping www.baidu.com
    cat /etc/resolv.conf
    cat /etc/sysconfig/network-scripts/ifcfg-eth0
  • nginx启动、停止、重启

    1
    2
    3
    4
    /usr/local/nginx/sbin/nginx (启动)
    /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
    /usr/local/nginx/sbin/nginx -s stop (停止)
    /usr/local/nginx/sbin/nginx -s reload (重启)
  • 通过ps命令查看nginx文件的路径

    1
    ps -elf | grep nginx
  • 删除/tmp目录中超过一天未使用的文件

    1
    tmpwatch 24 /tmp/ 
  • 查看文件夹大小并按大小进行排序详解

    1
    du -s * | sort -nr | head 选出排在前面的10个
  • 若您执行fdisk -l命令,发现没有/dev/xvdb,说明您的云服务无数据盘,那么您无需进行挂载

  • Php重启 /etc/init.d/php-fpm restart

  • Mysql禁止远程访问 /etc/my.cnf [mysqld]下加一行skip-networking

  • fsck –y 修复磁盘

  • 网站维护中,nginx加入代码rewrite ^(.*) /weihu.html break;

  • nginx去掉url中的index.php,配置Nginx.conf在你的虚拟主机下添加:

    1
    2
    3
    4
    5
    location / {
    if (!-e $request_filename){
    rewrite ^/(.*)$ /index.php/$1 last;
    }
    }
  • 使用top查看进程维度的CPU负载,在界面输入大小字母 P,来使监控结果按 CPU 使用率倒序排列.

  • Linux下如何关闭mysql的3306端口,#vi/etc/my.cnf 在[mysqld]下添加 skip-networking
    重启MYSQL: #service mysqld stop #service mysqldstart 即可关闭3306端口
    本地程序可以通过mysql.sock来连接,不影响使用,既提高了访问速度,又提高了安全性,避免远程连接mysql数据库

  • linux下给目录下所有子目录和文件赋权

    1
    chmod -R 777 目录名
  • llinux修复挂载点,首先卸载当前挂载的目录,root用户执行 umount /mnt,注意当前用户不要位于/mnt目录下,不能有应用正在使用/mnt目录。
    然后重新挂载/dev/xvdb1到新的目录,比如挂载到/test目录:

    1
    2
    mkdir /test
    mount /dev/xvdb1 /test
  • 关闭SELinux的方法
    修改/etc/selinux/config文件中设置SELINUX=disabled ,然后重启服务器。

  • 如果不想启用nginx日志,则使用: access_log off ;

  • mysql如何查看那些表数据量超大

    1
    2
    3
    4
    5
    6
    use information_schema;


    select table_name,table_rows from tables
    where TABLE_SCHEMA = '您的数据库名字'
    order by table_rows desc;
  • linux系统挂载数据盘的方法 https://www.jb51.net/article/122174.htm

  • linux下建立软链接,类似于windows下的快捷方式

    1
    2
    ln -s a b  a 就是源文件,b是链接文件名,其作用是当进入b,值得注意的是a目录已经建立,目录b没有建立
    rm -rf b 注意不是rm -rf b/ 删除软链接
  • g01更换绑定帐号

    1
    2
    3
      cd /usr/local/gov_defence_agent
    ./yunsuo_smart_tool.sh –u 用户名 –p密码

  • zip命令 打包/home/images目录到/home/images.zip

    1
    zip -r /home/images.zip /home/images
  • rm命令 删除 subfolder 下所有文件及文件夹,包括自身,-v可查看删除进度。
      rm -rf –v folder/subfolder/
  • find命令 find –name 文件名
  • du –h #统计当前目录的大小,以直观方式展现
  • ctrl+c暂停
  • ls列目录
  • nginx
    重启/usr/nginx/sbin/nginx -s reload
    查询nginx主进程号ps -ef | grep nginx (master进程编号就是主进程号了。)
  • tar –zcvf test.tar.gz test
  • pwd显示当前目录
  • ln –s /目标目录 所需目录 制作软链接
  mv aaa bbb  //将文件 aaa 更名为 bbb 
  • df –h查看磁盘使用情况

  • cat /etc/issue 查看系统版本

  • 在某目录下查找名为“elm.cc”的文件 find /home/lijiajia/ -name elm.cc

  • 查找文件名中包含某字符(如”elm”)的文件find /home/lijiajia/ -name ‘elm‘

  • vi 文件名
    a进入编辑状态 esc退出编辑状态 :q!退出 :wq保存退出

  • 查看linux服务器上有几块磁盘?

    lsblk

  • 查看系统版本

    lsb_release -a

    1
    strace -p 进程号  //跟踪进程,查看异常进程,cpu占用率过高时候使用  grep -rn "log1" ./     //在当前目录所有文件递归查找字符串log

二、Mysql

  • 开启慢查询命令
    1
    2
    set global log_slow_queries = on; 

  • 查看是否开启
    1
    show variables like 'log_slow_queries'; 
  • 数据库的操作 http://www.cnblogs.com/xiaochaohuashengmi/archive/2011/10/18/2216279.html

-如何判断Linux是32位还是64位

 getconf LONG_BIT//如果是32位机器,则结果为32
  • 导出全部数据库

    1
    2
    ./mysqldump -u root -p shujuku > name.sql   
    //输入后会让你输入进入MySQL的密码,如果导出单张表的话在数据库名后面输入表名即可
  • 查看Linux系统是32位还是64位

    getconf LONG_BIT

  • lsblk # 查看Linux有几个磁盘
1
2
//批量的更换域名mysql数据库语句
UPDATE newsdata set content=replace(content, 'http://www.***.gov.cn', 'http://***.***.gov.cn');

云推送

Posted on 2020-12-16
  • Bark用法:https://shimo.im/docs/63h3P6g38Ptc9xcc/read

  • Server酱用法:http://sc.ftqq.com/3.version

  • 钉钉推送用法:http://note.youdao.com/s/Fegc5kkQ

酷软清单

Posted on 2020-12-16

编程开发

  • notepad++(YaHei.Consolas.1.12.ttf,Source-Code-Pro编程字体、思源黑体/宋体、Noto Serif黑体/宋体、explorer)

  • vscode(sftp)

  • phpstorm(Material Theme UI插件)

    自动补全快捷键TAB

  • Chrome(集装箱、fehelper、uBlock Origin、Listen 1、Onetab、Infinity、Imagus)

  • phpstrom

  • Visual Studio Code

  • WinSCP

  • 向日葵、ToDesk

  • FileZilla Client

  • FastStone Capture

  • clover

  • Teleport ultra扒站神器

  • 文件叔叔

  • 云锁

  • GIT、Npm、Webpack

  • Honeyview(图片查看器)

  • Access2MySQL Pro

办公软件

  • Typora(主题:Vue 和 Bear 、VLOOK)
  • Adobe Photoshop CS3

应用软件

  • InternetDownloadManager
  • 爱思助手
  • 滴答清单
  • VMware Workstation
  • 坚果云
  • 美捷闹钟
  • 石墨文档
  • QQ影音
  • 爱思助手7
  • 火绒安全软件
  • KeePass
  • 网易有道词典
  • Xdown
  • PicGo
  • 网易云音乐
  • WeNAT
  • 花生壳
  • NATAPP

7 posts
1 tags
© 2022 带你灰
Powered by Hexo
|
Theme — NexT.Gemini v5.1.4