Skip to content

Instantly share code, notes, and snippets.

View zhanglianxin's full-sized avatar
🏃‍♂️
Running

Lianxin Zhang zhanglianxin

🏃‍♂️
Running
View GitHub Profile
<?php
if (!function_exists('arr_sum')) {
/**
* Replacement with bc math function for internal array_sum
*
* @param array $arr
* @param int $scale
*
* @return mixed
<?php
if (!function_exists('dd')) {
/**
* @return void
*/
function dd()
{
if (!in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && !headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
<?php
if (!function_exists('random_str')) {
/**
* Generate specific length random string
*
* @param $len
* @param $special
* @return string
*/
# /run/systemd/generator/www.mount
# Automatically generated by systemd-fstab-generator
[Unit]
SourcePath=/etc/fstab
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
Before=local-fs.target
[Mount]
What=/dev/sdb1
@zhanglianxin
zhanglianxin / SuppressUnsupportedOSWarning.reg
Created April 2, 2023 05:45
Suppress Unsupported OS Warning in Chrome
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Policies\Google\Chrome]
"SuppressUnsupportedOSWarning"=dword:00000001
@zhanglianxin
zhanglianxin / generate_username
Created December 23, 2022 07:52
reddit random username
https://www.reddit.com/api/v1/generate_username.json
@zhanglianxin
zhanglianxin / update-v2ray-core.sh
Last active December 7, 2023 08:57
Update V2Ray core files for V2rayU(v3.2.0) on macOS.
#!/bin/bash
# for [V2rayU](https://github.com/yanue/V2rayU).
V2RAY_HOME=~/v2ray-core
INAPP_DIR=/Applications/V2rayU.app/Contents/Resources/v2ray-core
INUSER_DIR=~/.V2rayU/v2ray-core
# brew install --cask v2rayu
# brew install v2ray xray
@zhanglianxin
zhanglianxin / restore-real-ip.conf
Created April 14, 2022 15:44
Restore client real IP
real_ip_header X-Forwarded-For;
set_real_ip_from 0.0.0.0/0;
set_real_ip_from 2400:cb00::/32;
set_real_ip_from 2606:4700::/32;
set_real_ip_from 2803:f800::/32;
set_real_ip_from 2405:b500::/32;
set_real_ip_from 2405:8100::/32;
set_real_ip_from 2c0f:f248::/32;
set_real_ip_from 2a06:98c0::/29;
@zhanglianxin
zhanglianxin / springboot.service
Last active January 19, 2022 07:51
deploy spring boot non-executable jar as a service
[Unit]
Description=app
After=syslog.target
[Service]
User=nobody
Restart=on-failure
RestartSec=5s
WorkingDirectory=/path/to/dir
ExecStart=/usr/bin/java -jar app.jar >> /dev/null 2>&1