Skip to content

Instantly share code, notes, and snippets.

View HubQin's full-sized avatar
🏋️‍♂️
Focusing

Qin HubQin

🏋️‍♂️
Focusing
  • zhuhai china
View GitHub Profile
@Hanson
Hanson / LogServiceProvider.php
Created November 25, 2019 10:03
Laravel global model's log. You can rerord the admin's operation.
<?php
namespace App\Providers;
use App\Models\AdminLog;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\ServiceProvider;
class LogServiceProvider extends ServiceProvider
class PyTrieNode(object):
def __init__(self, key="", seq=[]):
self.key = key
self.end = len(seq) == 0
self.children = {}
if len(seq) > 0:
self.children[seq[0]] = PyTrieNode(seq[0], seq[1:])
def add(self, seq):
if len(seq) == 0:
@cxa
cxa / regexCheatsheet.js
Last active August 14, 2023 10:01 — forked from sarthology/regexCheatsheet.js
A regex cheatsheet 👩🏻‍💻 (by Catherine)
let regex;
/* 匹配特定的字符串 */
regex = /hello/; // 查找斜杠中的字符串(大小写敏感)……匹配 "hello", "hello123", "123hello123", "123hello",但不匹配 "hell0", "Hello"
regex = /hello/i; // 查找斜杠中的字符串(大小写不敏感)……匹配 "hello", "HelLo", "123HelLO"
regex = /hello/g; // 全局查找斜杠中的字符串……
/* 通配符 */
regex = /h.llo/; // "." 匹配除了换行外的任何一个字符……匹配 "hello", "hallo",但不匹配 "h\nllo"
regex = /h.*llo/; // "*" 匹配任何字符零次或多次,如 "hello", "heeeeeello", "hllo", "hwarwareallo"
@lokielse
lokielse / _ide_helper_redis.php
Created April 26, 2018 17:51
Laravel IDE helper for Redis
<?php
// source version: https://github.com/JetBrains/phpstorm-stubs/blob/master/redis/Redis.phpdis/Redis.php
// phpdoc version: https://github.com/nrk/predis/blob/v1.1/src/ClientInterface.php
// save this file to your project root
namespace {
exit("This file should not be included, only analyzed by your IDE");
/**
@fotock
fotock / nginx.conf
Last active February 27, 2026 22:00 — forked from plentz/nginx.conf
Nginx SSL 安全配置最佳实践.
# 生成 dhparam.pem 文件, 在命令行执行任一方法:
# 方法1: 很慢
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
# 方法2: 较快
# 与方法1无明显区别. 2048位也足够用, 4096更强
openssl dhparam -dsaparam -out /etc/nginx/ssl/dhparam.pem 4096
<!doctype>
<html>
<head>
</head>
<body>
<?php
require_once "Classes/PHPExcel.php";
$tmpfname = "test.xlsx";
@Xarrow
Xarrow / login_zhihu.py
Created January 11, 2016 05:25
login_zhihu_by_requests
__author__ = 'ZhangJian'
import requests
import time
import sys
import os
import log
from bs4 import BeautifulSoup
from subprocess import Popen
@carbontwelve
carbontwelve / usefull_commands.sh
Last active January 28, 2026 18:59
Running xdebug in the console, for debugging Laravel artisan commands. Useful as I keep forgetting this one...
# Running xdebug in the console, for debugging Laravel artisan commands. Useful as I keep forgetting this one...
php -dxdebug.remote_autostart artisan
#Running phpcs for 5.3:
phpcs -pv --standards= --runtime-set testVersion 5.3 --ignore=*/public/*,*.js,*.css,*/tests/*,*/views/training/* .
@plentz
plentz / nginx.conf
Last active March 20, 2026 08:40
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048