Skip to content

Instantly share code, notes, and snippets.

View greatbody's full-sized avatar

Rui Sun greatbody

View GitHub Profile
@greatbody
greatbody / install.sh
Last active September 9, 2024 06:52
One key xboard
#!/bin/bash
# 安装 Docker & Docker Compose
echo ">>> Installing Docker & Docker Compose..."
curl -sSL https://get.docker.com | bash
# Xboard 安装及配置
echo ">>> Installing and configuring Xboard..."
# 获取Docker compose 文件
[Unit]
Description=Ollama Service
After=network-online.target
[Service]
ExecStart=/usr/local/bin/ollama serve
User=ollama
Group=ollama
Restart=always
RestartSec=3
@greatbody
greatbody / config
Last active December 25, 2023 07:42
config v2ray db
sudo sqlite3 /etc/x-ui/x-ui.db << EOF
INSERT INTO inbounds (user_id, up, down, total, remark, enable, expiry_time, listen, port, protocol, settings, stream_settings, tag, sniffing)
VALUES (1, 0, 0, 0, 'default', 1, 0, '', "$GCPPORT", 'vmess', '{"clients": [{"id": "$GCPID", "alterId": 0}], "disableInsecureEncryption": false}', '{"network": "ws", "security": "none", "wsSettings": {"path": "/", "headers": {"Host": "$GCPHOST"}}}', 'inbound-"$GCPPORT"', '{"enabled": true, "destOverride": ["http", "tls"]}')
EOF
@greatbody
greatbody / config.json
Created December 24, 2023 16:04
json for v2ray
{
"log": null,
"routing": {
"rules": [
{
"inboundTag": [
"api"
],
"outboundTag": "api",
"type": "field"
@greatbody
greatbody / add_share.sh
Created December 18, 2023 09:23
Create a Samba share using script
#!/bin/bash
# With GPT-4 assitant
# Function to validate the existence of the provided path
validate_path() {
echo -e "\033[33mPath to share:\033[0m" # Yellow prompt
while true; do
read -r share_path
if [ -d "$share_path" ]; then
class PageManager {
constructor() {
this.conditionalWorks = [];
this.activeConditionWork = null;
setInterval(() => {
this.conditionalWorks.forEach(cw => {
cw.conditionWork.report();
});
}, 1000);
}
#!/bin/bash
# update package
apt-get update -y
apt install shadowsocks-libev -y
echo "{
\"server\": \"SERVER_IP\",
\"server_port\": 443,
@greatbody
greatbody / install.sh
Last active April 3, 2019 14:06 — forked from chuyik/install.sh
Bandwagon(搬瓦工) CentOS 7 安装 shadowsocks-libev 和 kcptun
######################
## shadowsocks-libev
######################
# install dependencies
yum install epel-release -y
yum-config-manager --enable epel
yum install gcc gettext autoconf libtool automake make pcre-devel asciidoc xmlto udns-devel libev-devel wget libsodium -y
# install shadowsocks-libev
@greatbody
greatbody / vbCopyMemorySetBytes.bas
Created January 24, 2019 15:56
VB6使用CopyMemory逐字节设置Long型变量
Private Sub m_SetBytes(ByRef DestValue As Long, ByVal SourceValue As Long, ByVal Offset As Long, ByVal Length As Long)
m_CopyMemory DestValue, SourceValue, Offset, 0, Length
End Sub
Private Sub m_CopyMemory(ByRef DestValue As Long, ByVal SourceValue As Long, ByVal DestOffset As Long, ByVal SourceOffset As Long, ByVal Length As Long)
CopyMemory ByVal VarPtr(DestValue) + DestOffset, ByVal VarPtr(SourceValue) + SourceOffset, Length
End Sub
@greatbody
greatbody / pull-git-folders.sh
Last active January 15, 2019 03:19
Say you have a project with many repos and you can run this scripts to pull all git repos inside a folder
#!/bin/sh
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
echo_green()
{
echo "${green}$1${reset}"
}