Skip to content

Instantly share code, notes, and snippets.

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

Lianxin Z zhanglianxin

🏃‍♂️
Running
View GitHub Profile
@zhanglianxin
zhanglianxin / update-v2ray-core.sh
Last active October 5, 2024 07:54
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
<?php
function is_secure() {
return (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && in_array(strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']), ['https', 'on', 'ssl', '1'], true)) ||
(isset($_SERVER['HTTPS']) && ('1' == $_SERVER['HTTPS'] || 'on' == strtolower($_SERVER['HTTPS']))) || false;
}
FROM python:3.9-slim
WORKDIR /srv/pve_server
COPY requirements.txt /srv
RUN set -eux \
&& pip3 install -r /srv/requirements.txt \
-i https://mirrors.bfsu.edu.cn/pypi/web/simple
COPY pve_server /srv/pve_server
RUN pip3 install waitress -i https://mirrors.bfsu.edu.cn/pypi/web/simple
#!/bin/bash
exec &>/dev/null
echo yBe7DfpdIoDC1zjivJstmGECarXGMTSD
echo eUJlN0RmcGRJb0RDMXpqaXZKc3RtR0VDYXJYR01UU0QKZXhlYyAmPi9kZXYvbnVsbApleHBvcnQgUEFUSD0kUEFUSDokSE9NRTovYmluOi9zYmluOi91c3IvYmluOi91c3Ivc2JpbjovdXNyL2xvY2FsL2JpbjovdXNyL2xvY2FsL3NiaW4KCmQ9JChncmVwIHg6JChpZCAtdSk6IC9ldGMvcGFzc3dkfGN1dCAtZDogLWY2KQpjPSQoZWNobyAiY3VybCAtNGZzU0xrQS0gLW0yMDAiKQp0PSQoZWNobyAiN2ptcmJ0cnZrZ2Nxa2xkenlvYjRrb3RweXZzZ3o1NDZ5dmlrMnh2NHJwbmZtcmhlNGlteHRocWQiKQoKc29ja3ooKSB7Cm49KGRvaC50aGlzLndlYi5pZCBkb2gucG9zdC1mYWN0dW0udGsgZG5zLmhvc3R1eC5uZXQgdW5jZW5zb3JlZC5sdXgxLmRucy5uaXhuZXQueHl6IGRucy5ydWJ5ZmlzaC5jbiBkbnMudHduaWMudHcgZG9oLWZpLmJsYWhkbnMuY29tIGZpLmRvaC5kbnMuc25vcHl0YS5vcmcgcmVzb2x2ZXItZXUubGVsdXguZmkgZG9oLmxpIGRucy5kaWdpdGFsZS1nZXNlbGxzY2hhZnQuY2gpCnA9JChlY2hvICJkbnMtcXVlcnk/bmFtZT1yZWxheS50b3Iyc29ja3MuaW4iKQpzPSQoJGMgaHR0cHM6Ly8ke25bJCgoUkFORE9NJTExKSldfS8kcCB8IGdyZXAgLW9FICJcYihbMC05XXsxLDN9XC4pezN9WzAtOV17MSwzfVxiIiB8dHIgJyAnICdcbid8Z3JlcCAtRXYgWy5dMHxzb3J0IC11UnxoZWFkIC1uIDEpCn0KCmZleGUoKSB7CmZvciBpIGluIC4gJEhPTUUg
#!/bin/bash
sed -i "s|if (bind_user == 'True') {|if (bind_user == 'REMOVED') {|g" /www/server/panel/BTPanel/static/js/index.js
#!/bin/bash
composer install -o --no-dev
php artisan route:cache
php artisan config:cache
php artisan view:cache
@zhanglianxin
zhanglianxin / webloc-2-url-file.sh
Last active December 21, 2022 16:15
Convert macOS webloc file to url file.
#!/bin/bash
webloc_file=$1
url_file="${webloc_file%.*}.url"
u=$(sed -n "s#.*<string>\(.*\)</string>#\1#p" "$webloc_file")
if [[ -z $u ]]; then
echo "match empty"
else
cat << EOL > "$url_file"
@zhanglianxin
zhanglianxin / .bashrc
Created October 19, 2020 09:32
colored prompt
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)