Skip to content

Instantly share code, notes, and snippets.

View crazywhalecc's full-sized avatar

Jerry Ma crazywhalecc

  • Shanghai
  • 21:53 (UTC +08:00)
View GitHub Profile
@crazywhalecc
crazywhalecc / MiraiPatch.php
Last active May 8, 2020 12:31
zhamao-framework connect with mirai
<?php
// TODO: 还没写
<?php
/**
* Created by PhpStorm.
* User: jerry
* Date: 2018/4/10
* Time: 14:35
*/
namespace crazybot\mods;
private function doSign() {
$sign_data = DP::query("SELECT * FROM sign_data WHERE user_id = ?", [$this->getUserId()]);
if ($sign_data == []) $sign_data = $this->initData();
else $sign_data = $sign_data[0];
$today_zero = TimeManager::getTodayZero();
if ($sign_data["last_sign"] >= $today_zero) return false;//签过了
$last_day_zero = $today_zero - 86400;
if ($sign_data["last_sign"] >= $last_day_zero) {//是不是连签
$sign_data["sign_day_long"]++;
<?php
declare(strict_types=1);
namespace ZM\Annotation\CQ;
use Attribute;
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
use Doctrine\Common\Annotations\Annotation\Required;
use ZM\Annotation\AnnotationBase;
@crazywhalecc
crazywhalecc / backup.ps1
Created September 15, 2022 07:22
PowerShell 备份多个 Hyper-V 虚拟机到 NAS 并压缩
# 注意,需要先安装 7-zip 到 Program Files 目录!
# 时间格式结尾
$bak_time = Get-Date -Format 'yyyy-M-d'
# 临时存放导出位置的目录
$backup_tmp_dir = "F:\export-vm"
# 保存压缩文件的目标目录,我这里使用了NAS的目录
$backup_remote_dir = "\\10.10.10.5\虚拟机备份"
@crazywhalecc
crazywhalecc / OneBotEvent.php
Created December 19, 2022 13:28
OneBotEvent.php
<?php
declare(strict_types=1);
namespace OneBot\V12\Object;
use OneBot\Util\Utils;
use OneBot\V12\Exception\OneBotException;
use OneBot\V12\Validator;
<?php
class ActionResponse implements \JsonSerializable, \IteratorAggregate
{
public string $status = 'ok';
public int $retcode = 0;
/**
* @var mixed
*/
@crazywhalecc
crazywhalecc / GitStrategy.php
Created February 27, 2023 16:05
GitStrategy
<?php
namespace ZM\Plugin\Strategy;
use ZM\Utils\ZMRequest;
use ZM\Utils\ZMUtil;
class GitStrategy extends PluginInstallStrategy
{
private string $git_api_link = 'https://api.github.com/repos/{owner}/{repo}/contents/composer.json';
@crazywhalecc
crazywhalecc / OneBot12Ws.php
Created May 20, 2023 10:25
炸毛框架 3.0 正向 WS 适配插件
<?php
declare(strict_types=1);
namespace ZMPlugin\OneBotWS;
use Choir\WebSocket\CloseFrameInterface;
use Choir\WebSocket\FrameInterface;
use Choir\WebSocket\Opcode;
use MessagePack\MessagePack;
@crazywhalecc
crazywhalecc / a.php
Created July 9, 2023 10:01
PHP 写的手机号 MD5 爆破脚本
<?php
$phone = '13345454545';
$a = md5($phone, true);
$bss = md5($phone);
use Swoole\Process;
$starttime = microtime(true);