Skip to content

Instantly share code, notes, and snippets.

@eddy8
eddy8 / nginx.md
Created January 5, 2025 12:31
nginx tips

https 部署自签名 ssl 证书

生成证书:

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /cert/nginxselfsigned.key -out /cert/nginxselfsigned.crt

配置 Nginx:

server {
  listen 127.0.0.1:80;
 listen 127.0.0.1:443 ssl;
@eddy8
eddy8 / git.md
Last active January 5, 2025 12:37
git 注意事项

换行符的自动转换问题

#全局配置
git config --global core.autocrlf false

#仓库单独配置,在仓库目录下执行
git config core.autocrlf false

core.autocrlf有以下三种配置,建议设置为false

  • false:不进行换行符的自动转换,保留文件的原始换行符。
@eddy8
eddy8 / download_talebook.sh
Created April 8, 2022 02:48 — forked from syhily/download_talebook.sh
Download all the books from a talebook website. The https://curl.se/ and https://stedolan.github.io/jq/ are required for using this script.
#!/usr/bin/env bash
# Download metadata, modify these as your needs.
## The directory to save the downloaded files.
download_directory="/volume1/Download/EPUB"
## The website you want to visit.
calibre_site="http://soulseeker.myds.me:25788"
## The formats you want to download. We only download the first present format.
## All the formats should be upper case.
allow_formats=( EPUB MOBI AZW3 )
@eddy8
eddy8 / laravel_eloquent_seperate_table.php
Created November 22, 2021 02:02
laravel Eloquent seperate table
<?php
namespace App\Model;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
/**
* 分表关联数据加载
*/
@eddy8
eddy8 / mysql-5.7-master-slave-replication-centos-7.md
Created November 11, 2021 06:05
MySQL 5.7 Master-Slave Replication on CentOS 7

MySQL 5.7 Master-Slave Replication on CentOS 7

Install and configure MySQL 5.7 with master-slave replication. The benefits of this include high availability, backups, disaster recovery and reporting.

Install MySQL 5.7

Enable MySQL repository

yum localinstall -y https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
@eddy8
eddy8 / xtrabackup.sh
Created May 9, 2021 12:25
backup MySQL database by xtrabackup
#!/bin/bash
day=`date +%w`
dt=`date +%Y%m%d`
lastday=`date -d '1 days ago' +%Y%m%d`
user=root
pwd='6021c6e041b52921'
log=backuplog.`date +%Y%m%d`
case $day in
0)
@eddy8
eddy8 / swoole_multi_process.php
Created March 19, 2021 05:53
swoole multi process
<?php
use Swoole\Process;
$filePaths = file_get_contents('./data/origin_url.txt');
$pathArr = explode("\n", $filePaths);
$pathArrSplit = array_chunk($pathArr, 5000);
$processNum = count($pathArrSplit);
foreach ($pathArrSplit as $data) {

Keybase proof

I hereby claim:

  • I am eddy8 on github.
  • I am eddy8 (https://keybase.io/eddy8) on keybase.
  • I have a public key ASD4PMLzRUzkNJdnkgnB_hH0IEiKbYspa1OUeYgO5F0oLQo

To claim this, I am signing this object:

<?php
/**
* 删除指定目录,含子目录及目录下文件
*
* @param string $path 路径
* @return void
*/
function deleteAll($path)
{
$di = new DirectoryIterator($path);
@eddy8
eddy8 / MyQueueException.php
Last active June 15, 2021 01:11
use laravel queue standalone v5.3
<?php
/**
* 异常处理类
*/
use \Illuminate\Contracts\Debug\ExceptionHandler;
class MyQueueException implements ExceptionHandler
{
/**