2023-07-05 09:17:48    121    0    0

安装

  1. curl -fsSL https://code-server.dev/install.sh | sh

编辑配置文件,放开监听端口

  1. vi ~/.config/code-server/config.yaml
  2. ufw allow

开机启动

  1. sudo systemctl enable --now code-server@$USER

手工启动

  1. code-server
2023-06-07 14:57:34    55    0    0
  1. 在控制台添加函数

    1. (function(console){
    2. console.save = function(data, filename){
    3. if(!data) {
    4. console.error('Console.save: No data')
    5. return;
    6. }
    7. if(!filename) filename = 'console.json'
    8. var blob = new Blob([data], {type: 'text/json'}),
    9. e = document.createEvent('MouseEvents'),
    10. a = document.createElement('a')
    11. a.download = filename
    12. a.href = window.URL.createObjectURL(blob)
    13. a.dataset.downloadurl = ['text/json', a.download, a.href].join(':')
    14. e.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null)
    15. a.dispatchEvent(e)
    16. }
    17. })(console)
  2. 执行导出

    1. console(temp1,1.txt)
oracle cloud    2022-05-14 20:59:46    123    0    0
  1. rclone安装

    1. curl https://rclone.org/install.sh | sudo bash
  2. oracle cloud客户密钥申请

    • 登陆oracle cloud,右上角进入 “我的概要信息”
    • 选择客户密钥并生成,输入名称后生成secret_access_key,复制保存
    • 返回后界面获取访问密钥access_key_id
  3. 获取存储桶信息及区域
    查看存储桶详细,获取“名称空间”(Namespace)
    区域即存储桶所在区域,比如韩国春川(ap-chuncheon-1)

  4. rclone配置
    按照客户密钥及存储桶信息生成配置。在ubuntu环境下,rclone的配置文件位于"~/.config/rclone/rclone.conf",在一个环境配置好后,可直接复制文件到相应位置

    1. rclone config

    按提示依次输入信息,输入完后配置项及说明如下如下:

    1. #cloud为rclone config中输入到配置名称
    2. [cloud]
    3. type = s3
    4. provider = Other
    5. access_key_id =
    6. secret_access_key =
    7. # 替换Namespace及ap-chuncheon-1
    8. endpoint = https://Namespace.compat.objectstorage.ap-chuncheon-1.oraclecloud.com
    9. acl = private
    10. region = ap-chuncheon-1
    11. bucket_acl = private
  5. 挂载/卸载本地目录

    • 挂载(cloud为配置到名称)

      1. rclone mount cloud:/ 本地目录 --copy-links --allow-other --allow-non-empty --umask 000 --daemon
    • 卸载

      1. fusermount -qzu 本地目录
  6. 其他常用操作

    • 不挂载查看文件

      1. rclone ls cloud:/
2022-05-13 16:30:52    154    0    0
  1. apt update;apt upgrade -y;
  2. apt-get install software-properties-common -y
  3. apt-get install git libpulse-dev autoconf m4 intltool dpkg-dev libtool libsndfile-dev libcap-dev libjson-c-dev -y
  4. apt-get build-dep pulseaudio -y
  5. chmod 777 pul*.dsc
  6. apt source pulseaudio
  7. cd pulseaudio-13.99.1
  8. ./configure
  9. cd ../
  10. git clone https://github.com/neutrinolabs/pulseaudio-module-xrdp.git
  11. cd pulseaudio-module-xrdp
  12. ./bootstrap
  13. ./configure PULSE_DIR="/root/pulseaudio-13.99.1"
  14. make
  15. cd src/.libs
  16. install -t "/var/lib/xrdp-pulseaudio-installer" -D -m 644 *.so
  17. install -t "/usr/lib/pulse-13.99.1/modules" -D -m 644 *.so
  18. reboot


2022-05-13 10:54:16    122    0    0

cdn.bootcss.com域名已变更

可调整为如下两个源:

  • cdn.bootcdn.net/ajax/libs
  • cdnjs.cloudflare.com/ajax/libs

蚂蚁笔记修改如下文件

  • src\github.com\leanote\leanote\app\views\note\note-dev.html
  • src\github.com\leanote\leanote\app\views\note\note.html
  • src\github.com\leanote\leanote\public\libs\md2html\md2html.js
2022-05-04 18:10:12    155    0    0
  • 安装MongoDB

    1. wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
    2. echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
    3. apt-get update
    4. apt-get install -y mongodb-org
    5. systemctl start mongod
  • 备份还原数据库

    • 备份

      1. mongodump --port 27017 --db leanote -o /data/leanoteBackUp/
    • 还原

      1. mongorestore -h 127.0.0.1:27017 -d leanote /developer/data/leanoteBackUp/leanote -u=root -p=xxxx
  • 覆盖原src目录
2022-04-04 22:39:59    162    0    0
  1. rndc生成配置文件

    1. rndc-confgen > /etc/rndc.conf
  2. 密钥覆盖到 /etc/rndc.key

  3. named配置文件调整

    • 添加key包含
    • 参照/etc/rndc.conf添加权限控制
  4. 刷新域名

    1. rndc freeze example.com
    2. rndc thaw example.com
2022-04-04 21:35:20    127    0    0
  1. #!/bin/bash
  2. echo root:password |sudo chpasswd root
  3. sudo sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config;
  4. sudo sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config;
  5. sudo service sshd restart
2022-04-04 21:07:48    179    0    0
  1. 安装

    1. yum -y install bind bind-chroot bind-utils
  2. 生成更新密钥

    1. //采用HMAC-MD5
    2. dnssec-keygen -a HMAC-MD5 -b 128 -n USER dnskey
    3. //采用HMAC-SHA1,go-nsupdate不支持HMAC-MD5
    4. dnssec-keygen -a HMAC-SHA1 -T KEY -b 128 -n USER dnskey
  3. 调整监听端口及密文

    1. vi /etc/named.conf
    2. key "dnskey" {
    3. algorithm hmac-md5;
    4. //algorithm hmac-sha1;
    5. secret "secret_key";
    6. }
  4. 添加域名

    1. vi /etc/named.rfc1912.zones
    2. zone "test.cn" IN {
    3. type master;
    4. file "named.test";
    5. allow-update { key dnskey; };
    6. };
  5. 添加域名配置并修改信息

    1. cp /var/named/named.localhost /var/named/named.test
  6. 重启named

    1. systemctl restart named
  7. 客户端更新

    1. nsupdate -y dnskey:secret_key
    2. //nsupdate默认为hmac-md5,非该类型要指定加密方式
    3. //nsupdate -y hmac-sha1: dnskey:secret_key
    4. > server x.x.x.x
    5. > update add test.cn 86400 A 3.3.3.3
    6. > send
    7. > quit
    8. //go-nsupdate 更新
    9. ./go-nsupdate -i enp0s3 --server=x.x.x.x --interface-family=ipv4 --tsig-algorithm=hmac-sha1 --tsig-name=dnskey --tsig-secret=secret_key --zone=test.cn a1.test.cn -v
  8. 核对记录

    1. dig @X.X.X.X test.cn
  9. 查看日

2022-03-06 14:06:27    101    0    0
本方式来源于https://gist.github.com/lilydjwg/93d33ed04547e1b9f7a86b64ef2ed058 ``` #!/usr/bin/python3 import asyncio import time import socket import argparse import aiohttp class MyConnector(aiohttp.TCP
1/2