Skip to content

Instantly share code, notes, and snippets.

View yourtion's full-sized avatar
🎯
Focusing

郭宇翔 yourtion

🎯
Focusing
View GitHub Profile
@yourtion
yourtion / agent loop
Created March 13, 2025 11:39 — forked from jlia0/agent loop
Manus tools and prompts
You are Manus, an AI agent created by the Manus team.
You excel at the following tasks:
1. Information gathering, fact-checking, and documentation
2. Data processing, analysis, and visualization
3. Writing multi-chapter articles and in-depth research reports
4. Creating websites, applications, and tools
5. Using programming to solve various problems beyond development
6. Various tasks that can be accomplished using computers and the internet
sed 's/\x1b\[[0-9;]*m//g'
const Mocha = require("mocha");
var constants = Mocha.Runner.constants;
var EVENT_RUN_END = constants.EVENT_RUN_END;
var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
var EVENT_SUITE_END = constants.EVENT_SUITE_END;
var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
const t = new Mocha();
t.addFile("./all.spec.js");
@yourtion
yourtion / backup_mysql.sh
Created June 20, 2019 04:26
备份MySQL并删除旧数据
#!/bin/bash
baseDir="/data/backup/mysql";
userName="root"
password="123456"
host="127.0.0.1"
backup() {
echo "开始备份数据库: $1"
mysqldump -h$host -u$userName -p$password --default-character-set=utf8 $1 | gzip > $baseDir/$1_dump_$(date +%Y%m%d_%H%M%S).sql.tar.gz
echo "备份数据完成";
@yourtion
yourtion / fmp-timing.js
Created November 26, 2018 07:50
前端监控实践——FMP的智能获取算法 https://segmentfault.com/a/1190000017092752
// https://github.com/qbright/fmp-timing/blob/master/src/fmp-timing.js
const START_TIME = performance && performance.timing.responseEnd;
const IGNORE_TAG_SET = ["SCRIPT", "STYLE", "META", "HEAD", "LINK"];
const TAG_WEIGHT_MAP = {
SVG: 2,
IMG: 2,
CANVAS: 4,
@yourtion
yourtion / Let'sEncrypt.sh
Last active October 4, 2018 04:00
Docker+Nginx+Let'sEncrypt
#!/bin/sh
# https://ruby-china.org/topics/31942
# Install
yum install -y epel-release
yum install -y certbot
# 使用方法:certbot certonly --webroot -w [Web站点目录] -d [站点域名] -m [联系人email地址] --agree-tos
certbot certonly --webroot -w /opt/www/demo.mydomain.com -d demo.mydomain.com -m myname@gmail.com --agree-tos
@yourtion
yourtion / mount_ntfs.sh
Created March 6, 2018 06:37
Mac下NTFS可写
1、列出所有的外接存储设备
$ diskutil list external
/dev/disk2 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *15.9 GB disk2
1: Windows_NTFS DBand 15.9 GB disk2s1
2、解挂载然后重新挂载
# 解挂载
@yourtion
yourtion / master.js
Created February 2, 2018 15:38
Node.js Simple IPC Timmer Demo
const { fork } = require('child_process');
const crypto = require('crypto');
const timmer = fork('./timmer.js');
let lastTime = Date.now();
let localTime = Date.now();
timmer.on('message', (m) => {
console.log('remote: ', m.time - lastTime - 1000 + 'ms');
@yourtion
yourtion / proxy.conf
Created January 8, 2018 02:49
NginxProxyConfig
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
function render(template, context) {
return template.replace(/\{\{(.*?)\}\}/g, (match, key) => context[key]);
}
const template = "{{name}}很厉name害,才{{age}}岁";
const context = { name: "yourtion", age: "15" };
console.log(render(template, context));