Skip to content

Instantly share code, notes, and snippets.

@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
{
/**
@eddy8
eddy8 / autowrite.php
Created April 1, 2017 07:30
Symfony DependencyInjection Autowire
<?php
namespace Eddy;
use Symfony\Component\DependencyInjection\Compiler\AutowirePass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
require 'vendor/autoload.php';
@eddy8
eddy8 / laravel_queue_standalone.php
Created March 14, 2017 08:18
laravel queue(v5.3) standalone with redis
<?php
use Illuminate\Queue\Capsule\Manager as Queue;
use Illuminate\Redis\Database as Redis;
require 'vendor/autoload.php';
$queue = new Queue;
$app = $queue->getContainer();
$manager = $queue->getQueueManager();