Skip to content

Instantly share code, notes, and snippets.

@Moln
Moln / git_add_ssh_key.md
Created March 29, 2017 10:35
Git add ssh key
  1. ssh-keygen -t rsa -C "memo"
  2. 在 gitlab 中添加 ssk-key 内容为 .ssh/id_rsa.pub 文件内容
  3. id_rsa 文件是被改名的, 要在 .ssh/config 中添加指向说明

指向说明示例:

Host 192.168.150.162
RSAAuthentication yes
IdentityFile ~/.ssh/gitlab_rsa
@Moln
Moln / mysql_note.md
Last active September 15, 2017 01:40
Mysql 处理大数据那些坑

数据 insert 效率只有每秒300

原因: mysql innodb引擎开启了日志事务功能,参数配置:my.cnf 默认 innodb_flush_log_at_trx_commit=1 调整为0;

修改后 insert 大概每秒 5000,

Delete 后的数据表,影响索引?

发现一数据总数据1700万, 由于程序脚本编写BUG导致, 向数据表误导入500+万数据. 经 Delete 语法删除尾部多余的 500+万数据后.

Html_video倒序播放功能

HTMLVideoElement.prototype.playBackwards = function() {
    this.pause();
    var video = this;
    var fps = video.fps || 25;
    var wait = 1000 / fps;
 var intervalRewind = setInterval(function() {
@Moln
Moln / PHP面试题.md
Last active December 27, 2018 10:36
PHP面试题

PHP面试题

PHP基础

1. 请写出以下结果:

echo json_encode(['a' => 1] + ['b' => 2, 'a' => 3, 'b']);
@Moln
Moln / Vue 文件打包错误.md
Created March 7, 2018 09:30
Vue 文件打包错误
Vue packages version mismatch:

- vue@2.5.10
- vue-template-compiler@2.5.13

This may cause things to work incorrectly. Make sure to use the same version for both.
If you are using vue-loader@>=10.0, simply update vue-template-compiler.
If you are using vue-loader@<10.0 or vueify, re-installing vue-loader/vueify should bump vue-template-compiler to the latest.
@Moln
Moln / 系统服务收集.md
Created June 27, 2018 00:50
系统服务收集

上监控系统:

  • Zabbix
  • Open-Falcon
  • Prometheus
  • Grafana
  • elk
@Moln
Moln / shell_notes.md
Created January 14, 2019 09:14
Linux Shell 笔记

本地代理开放给外网服务器

ssh -NfT -D 10080 root@localhost
ssh -N -f -b 0.0.0.0 -R 10080:localhost:10080 root@remote.host
@Moln
Moln / Api-platform研究记录.md
Last active January 17, 2020 04:57
Api-platform研究记录
  • Entity 生成路由

    • ApiPlatform 会根据 Entity 的 @ApiResource 注解, 自动生成路由.
    • 路由名称, 由 Inflector::pluralize(Greeting::class) 自动生成 /greetings 复数形式的资源名称
    • 单词间默认是 _ 分隔, 文档有记录更改单词分隔符
  • 自定义资源方式?

  • 过滤器原理?

  • 迁移Expressive 方案?

@Moln
Moln / wsl2-net.bat
Created April 13, 2022 14:06
WSL2 固定局域网IP
wsl -d Ubuntu-20.04 -u root ip addr del $(ip addr show eth0 ^| grep 'inet\b' ^| awk '{print $2}' ^| head -n 1) dev eth0
wsl -d Ubuntu-20.04 -u root ip addr add 192.168.50.2/24 broadcast 192.168.50.255 dev eth0
wsl -d Ubuntu-20.04 -u root ip route add 0.0.0.0/0 via 192.168.50.1 dev eth0
wsl -d Ubuntu-20.04 -u root echo nameserver 192.168.50.1 ^> /etc/resolv.conf
powershell -c "Get-NetAdapter 'vEthernet (WSL)' | Get-NetIPAddress | Remove-NetIPAddress -Confirm:$False; New-NetIPAddress -IPAddress 192.168.50.1 -PrefixLength 24 -InterfaceAlias 'vEthernet (WSL)'; Get-NetNat | ? Name -Eq WSLNat | Remove-NetNat -Confirm:$False; New-NetNat -Name WSLNat -InternalIPInterfaceAddressPrefix 192.168.50.0/24;"
@Moln
Moln / DoctrineOrmPool.php
Created December 22, 2022 01:22
swoole doctrine orm pool example
<?php
use Doctrine\DBAL\Exception\ConnectionLost;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use Swoole\ConnectionPool;
/**
*/