Skip to content

Instantly share code, notes, and snippets.

@diaolizhi
diaolizhi / getcookies.cs
Created October 23, 2018 11:05
C# WebBrowser 获取 HttpOnly 的 cookie
//不知道为什么有些 cookie 获取不到,只能通过这种方式解决
//这一次的用法是,先在 WebBrowser 登录贴吧网页版,然后将 http://tieba.baidu.com/mo/ 传给 GetCookie 方法
//就可以获取到所有 cookie
//需要引入 System.Net 并 using System.Net;
//下面这段代码作为内部类,如何使用在后面
internal static class CookieReader
{
/// <summary>
@diaolizhi
diaolizhi / clash.ini
Last active September 30, 2022 04:26
clash.yaml
[custom]
;这是一个外部配置文件示例
;所有可能的自定义设置如下所示
;用于自定义组的选项 会覆盖 主程序目录中的配置文件 里的内容
;使用以下模式生成 Clash 代理组,带有 "[]" 前缀将直接添加
;Format: Group_Name`select`Rule_1`Rule_2`...
; Group_Name`url-test|fallback|load-balance`Rule_1`Rule_2`...`test_url`interval[,timeout][,tolerance]
;Rule with "[]" prefix will be added directly.
@diaolizhi
diaolizhi / gist:67588a6be3d96b316fc0fb7d177b2dd2
Created November 9, 2021 12:13 — forked from codemis/gist:8225337
A Git pre-commit hook for validating code follows PHP's Fig Coding Standard. The script requires PEAR's Code Sniffer library. Change the variables to fit your project code structure. Just drop this file in your .git/hooks/ directory. This script is a modified file created by Soenke Ruempler.
#!/bin/bash
# PHP CodeSniffer pre-commit hook for git
#
# @author Soenke Ruempler <soenke@ruempler.eu>
# @author Sebastian Kaspari <s.kaspari@googlemail.com>
#
# see the README
PHPCS_BIN=/usr/local/bin/phpcs
PHPCS_CODING_STANDARD=PSR2
@diaolizhi
diaolizhi / vue.js
Created February 6, 2021 03:54
jsx element ui image javascript
{
type: 'common', label: '反馈图片', formatter: (row) => {
if (!row.images) {
return <div style='color: #999;'>未上传图片</div>
}
const res = []
for (let i = 0; i < row.images.length; i++) {
const imageList = row.images.slice(i, row.images.length).concat(row.images.slice(0, i))
res.push(<el-image style='width: 220px; display: inline-block; margin-bottom: 10px; margin-right: 10px' src={row.images[i]}
preview-src-list={imageList}
@diaolizhi
diaolizhi / WXPayUtil.java
Created July 16, 2019 01:27
微信支付工具类:Map、XML 的转换,生成、校验 sign
import org.w3c.dom.Entity;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
// ==UserScript==
// @name skip weibo guide
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 跳过微博向导
// @author zedlz
// @match https://weibo.com/*
// @grant none
// ==/UserScript==
try {
DB::beginTransaction();
DB::commit();
} catch (Exception $e) {
Log::error($e->getMessage());
DB::rollBack();
throw new ExceptionBiz($e->getMessage());
}
public function fans($userId)
{
// 1.1 检查用户是否存在
UserModel::mustExist(['id' => $userId, 'status' => BaseModel::ENABLED], '用户不存在或已被封禁');
// 2.1 查 user_follow 表, 找出跟当前用户相关的记录
$userFollows = UserFollowModel::where(['followed_user_id' => $userId])->paginate(request('pagesize', 20));
// 2.2 查询本次需要查询的 user_id
$ids = array_map(function ($item) {
<?php
namespace App\Listeners;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\Common\Models\UserFollowModel;
use Illuminate\Support\Facades\Redis;
use App\Common\Models\UserModel;
use Log;
@diaolizhi
diaolizhi / wxpay-callback.java
Created July 16, 2019 04:30
微信支付回调接口,接收通知并回复
@RequestMapping("callback")
public void callback(HttpServletRequest request, HttpServletResponse response) throws Exception {
InputStream inputStream = request.getInputStream();
//BufferedReader是包装设计模式,性能更搞
BufferedReader in = new BufferedReader(new InputStreamReader(inputStream,"UTF-8"));
StringBuffer sb = new StringBuffer();
String line ;
while ((line = in.readLine()) != null){
sb.append(line);