ctrl+z 撤回
全部选中然后tab是全部缩进
全部选中然后shift+tab是全部反缩进
dir() #输出函数包含的方法
type() #输出类型
更多技巧可以查阅官方文档的使用帮助。
]]>https://blog.csdn.net/hanshuonb/article/details/77969080
度娘上面我没有找到相关的解决方法所以只能去Stack Overflow上寻找答案,找到的结果是这样的:
sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf ~/.npm
brew uninstall --force node
brew install node
上面命令的意思删除所有全局包和.npm文件夹,重新安装node。
这种方法我没试过,因为肯定有很多小伙伴安装了除npm之外的全局包比如express、webpack等等,如果不考虑清楚直接全删了的话。。。后果惨不忍睹。。。(ps:因为本人英语实在不好,所以经常直接傻瓜式粘命令,提醒小伙伴们最好粘命令之前去查查是什么意思,否则出了问题有可能都没法回退。。。)
说了这么多,下面切入正题
首先需要知道为啥有报这个错,可以到全局的npm包看一下,路径是
/usr/local/lib/node_modules/npm
进入npm的node_modules中的semver文件夹可以看到里面变成空的了!具体的原因不好意思我没有深究,但是我觉得一定和yarn是有关系的。不仅如此,你会看到其他的文件夹也基本都是变成空的了,这下咱们就知道为啥报semver这个module找不到了吧!
网上还有解决方法是说用 npm unintall npm -g 删除npm包,实测不好使。。。npm所有的命令都不行了 uninstall肯定也不行了啊!!!
1.先删除全局的npm包:也就是把刚才提到的/usr/local/lib/node_modules/npm,这个npm文件夹删除掉
2.回到/usr/local/lib/node_modules这个目录,从GitHub上重新clone下git包
终端:
git clone --recursive git://github.com/isaacs/npm.git
这样新的npm包就回到了全局node_modules中
3.打开终端输入
npm -v
看一下npm是否可以打印出版本号,如果可以,npm就可以正常使用啦!
说白了就是:
rm -rf /usr/local/lib/node_modules/npm
cd /usr/local/lib/node_modules
git clone --recursive git://github.com/isaacs/npm.git`
搞定
]]>pacman -S mongo
/usr/bin/.mongo --help
systemctl start mongodb.service
这样就启动了mongo,启动的配置文件是:cat /etc/mongodb.conf
然后退出到用户目录,运行mongo
~ ❯❯❯ mongo
/var/lib/mongodb/ 是Arch Linux 的 ** 默认dbpath**
但是无法访问
修改mongodb的用户组为自己的
chown mongodb:lonelyor mongodb
mkdir /home/lonelyor/工作/mongodb
touch /home/lonelyor/工作/mongodb/data
touch /home/lonelyor/工作/mongodb/logs
aria2.conf配置:
#用户名
#rpc-user=user
#密码
#rpc-passwd=passwd
#上面的认证方式不建议使用,建议使用下面的token方式
#设置加密的密钥
rpc-secret=token
#允许rpc
enable-rpc=true
#允许所有来源, web界面跨域权限需要
rpc-allow-origin-all=true
#允许外部访问,false的话只监听本地端口
rpc-listen-all=true
#RPC端口, 仅当默认端口被占用时修改
rpc-listen-port=6800
#最大同时下载数(任务数), 路由建议值: 3
max-concurrent-downloads=5
#断点续传
continue=true
#同服务器连接数
max-connection-per-server=5
#最小文件分片大小, 下载线程数上限取决于能分出多少片, 对于小文件重要
min-split-size=10M
#单文件最大线程数, 路由建议值: 5
split=10
#下载速度限制
max-overall-download-limit=0
#单文件速度限制
max-download-limit=0
#上传速度限制
max-overall-upload-limit=0
#单文件速度限制
max-upload-limit=0
#断开速度过慢的连接
#lowest-speed-limit=0
#验证用,需要1.16.1之后的release版本
#referer=*
#文件保存路径, 默认为当前启动位置
dir=/root/downloads
#文件缓存, 使用内置的文件缓存, 如果你不相信Linux内核文件缓存和磁盘内置缓存时使用, 需要1.16及以上版本
#disk-cache=0
#另一种Linux文件缓存方式, 使用前确保您使用的内核支持此选项, 需要1.15及以上版本(?)
#enable-mmap=true
#文件预分配, 能有效降低文件碎片, 提高磁盘性能. 缺点是预分配时间较长
#所需时间 none < falloc ? trunc << prealloc, falloc和trunc需要文件系统和内核支持
file-allocation=prealloc
然后配置开机启动:
nano /etc/init.d/aria2
#!/bin/bash
#
# aria2 - this script starts and stops the aria2 daemon
#
# chkconfig: - 85 15
# description: Aria2 - Download Manager
# processname: aria2c
# config: /etc/aria2/aria2.conf
# pidfile:
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
aria2c="/usr/bin/aria2c"
ARIA2C_CONF_FILE="/etc/aria2/aria2.conf"
options=" --conf-path=$ARIA2C_CONF_FILE -D "
RETVAL=0
start() {
# code here to start the program
echo -n "Starting aria2c daemon."
${aria2c} ${options}
RETVAL=$?
echo
}
stop() {
echo -n "Shutting down aria2c daemon."
/usr/bin/killall aria2c
RETVAL=$?
echo
}
status() {
ID=$(/bin/ps -ef | grep 'aria2c' | grep -v 'grep' | awk '{print $2}')
if [[ "x$ID" != "x" ]]; then
echo "Aria2 is running."
else
echo "Aria2 is not running."
fi
}
restart() {
stop
sleep 3
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
restart
;;
*)
echo "Usage: service aria2c {start|stop|restart}"
RETVAL=1
esac
exit $RETVAL
使用以下命令来立即启动 Aria2:
/usr/bin/aria2c --conf-path=/etc/aria2_conf/aria2.conf -D
保存之后配置 WebUI,首先开启 Web 服务,然后安装 WebUI 到指定目录,比如我的目录是/opt/aria2webUI/
git clone https://github.com/ziahamza/webui-aria2.git
这样就下载了 WebUI,然后用 nginx 反代这个文件就ok了。
nginx(/etc/nginx/conf.d/aria2.conf)配置文件如下:
aria2.conf
server
{
listen 80;
server_name aria2.lonelyor.org;
location / {
root /opt/aria2webUI/;
}
access_log logs/aria2_access.log;
}
然后打开浏览器访问 aria2.lonelyor.org 就可以了。
]]>~/configsogou-qimpanelSogouPYSogouPY.usershttps://wiki.archlinux.org/index.php/Xrandr_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)
1、先使用xrandr查看屏幕相关信息
2、编辑/e/X/xorg.conf.d ❯❯❯ sudo nano 11-lonelyorx.conf (自己新建)
结果我不怎么会写配置文件,导致写了都没法启动图形界面了,于是又删了,打算手动更改。
3、
xrandr查看当前设置
cvt 1920 1080
cvt 2560 1440
找到正确的参数
xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
xrandr --newmode "2560x1440_60.00" 312.25 2560 2752 3024 3488 1440 1443 1448 1493 -hsync +vsync
然后设置
xrandr --addmode eDP1 1920x1080_60.00
xrandr --addmode HDMI1 2560x1440_60.00
如果一且顺利的话,此时再查看xrandr命令,将发现最佳分辨率设置成功。
4、修改分辨率
xrandr --output eDP1 --mode 1920x1080_60.00
xrandr --output HDMI1 --mode 2560x1440_60.00
xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
xrandr --addmode eDP1 1920x1080_60.00
xrandr --output eDP1 --mode 1920x1080_60.00
这样屏幕分辨率就变成1080p了。
]]>很久以前写的
跑弱口令的脚本
不要使用字典这种操作,这不利于跑大量数据的场景。
应该制定规则去跑,比如:
取出一个用户名,然后根据规则生成弱口令,然后再去匹配用户名对应的密码,匹配则是弱口令,不匹配则不是弱口令。
这样可以后续变成一个服务,用户输入密码,触发了规则则告诉他密码是弱口令。
curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall && \
chmod 755 msfinstall && \
./msfinstall
上面是官方提供的一键安装脚本
使用msfupdate可以进行更新
]]>lsof -i:8000netstat -tunlp|grep 8000多年以前的笔记
fsarchiver安装
apt-get install fsarchiver
# 对于备份操作,我们需要以只读形式重新挂载文件系统或者有条件的话直接卸载。也可以-A忽略
[peter@test88 ~]$ sudo /home/peter/fsarchiver savefs backup.fsa /dev/sdb1
oper_save.c#938,filesystem_mount_partition(): partition [/dev/sdb1] is mounted read/write. please mount it read-only
and then try again. you can do "mount -o remount,ro /dev/sdb1". you can
also run fsarchiver with option '-A' if you know what you are doing.
removed backup.fsa
# 对于恢复操作,我们必须先卸载文件系统。
[peter@test88 ~]$ sudo /home/peter/fsarchiver restfs backup2.fsa id=0,dest=/dev/sdb2
oper_restore.c#1230,extractar_filesystem_extract(): partition [/dev/sdb2] is mounted on [/home/peter/sder].
cannot restore an archive to a partition which is mounted, unmount it first: umount /home/peter/sder
# 创建文件系统备份
# 可以将多个文件系统备份在一个文件中
[peter@test88 ~]$ sudo /home/peter/fsarchiver savefs backup.fsa /dev/sdb1 /dev/sdb2
# 恢复文件系统
# id=0表明从归档中提取第一个文件系统的内容
[peter@test88 ~]$ sudo /home/peter/fsarchiver restfs backup.fsa id=0,dest=/dev/sdc1 id=1,dest=/dev/sdc2
# 软件说明文档
====> fsarchiver version 0.8.1 (2017-01-10) - http://www.fsarchiver.org <====
Distributed under the GPL v2 license (GNU General Public License v2).
* usage: fsarchiver [<options>] <command> <archive> [<dev1> [<dev2> [...]]]
<commands>
* savefs: save filesystems to an archive file (backup a device to a file)
* restfs: restore filesystems from an archive (overwrites the existing data)
* savedir: save directories to the archive (similar to a compressed tarball)
* restdir: restore data from an archive which is not based on a filesystem
* archinfo: show information about an existing archive file and its contents
* probe [detailed]: show list of filesystems detected on the disks
<options>
-o: overwrite the archive if it already exists instead of failing
-v: verbose mode (can be used several times to increase the level of details)
-d: debug mode (can be used several times to increase the level of details)
-A: allow to save a filesystem which is mounted in read-write (live backup)
-a: allow to save a filesystem when acls and xattrs are not supported
-x: enable support for experimental features (they are disabled by default)
-e <pattern>: exclude files and directories that match that pattern
-L <label>: set the label of the archive (comment about the contents)
-z <level>: compression level from 1 (very fast) to 9 (very good) default=3
-s <mbsize>: split the archive into several files of <mbsize> megabytes each
-j <count>: create more than one (de)compression thread. useful on multi-core cpu
-c <password>: encrypt/decrypt data in archive, "-c -" for interactive password
-h: show help and information about how to use fsarchiver with examples
-V: show program version and exit
<information>
* Support included for: lzo=yes, lzma=yes
* Support for ntfs filesystems is unstable: don't use it for production.
<examples>
* save only one filesystem (/dev/sda1) to an archive:
fsarchiver savefs /data/myarchive1.fsa /dev/sda1
* save two filesystems (/dev/sda1 and /dev/sdb1) to an archive:
fsarchiver savefs /data/myarchive2.fsa /dev/sda1 /dev/sdb1
* restore the first filesystem from an archive (first = number 0):
fsarchiver restfs /data/myarchive2.fsa id=0,dest=/dev/sda1
* restore the second filesystem from an archive (second = number 1):
fsarchiver restfs /data/myarchive2.fsa id=1,dest=/dev/sdb1
* restore two filesystems from an archive (number 0 and 1):
fsarchiver restfs /data/arch2.fsa id=0,dest=/dev/sda1 id=1,dest=/dev/sdb1
* restore a filesystem from an archive and convert it to reiserfs:
fsarchiver restfs /data/myarchive1.fsa id=0,dest=/dev/sda1,mkfs=reiserfs
* restore a filesystem from an archive and specify extra mkfs options:
fsarchiver restfs /data/myarchive1.fsa id=0,dest=/dev/sda1,mkfs=ext4,mkfsopt="-I 256"
* restore a filesystem from an archive and specify a new label and a new UUID:
fsarchiver restfs /data/myarchive1.fsa id=0,dest=/dev/sda1,label=root,uuid=5f6e5f4f-dc2a-4dbd-a6ea-9ca997cde75e
* save the contents of /usr/src/linux to an archive (similar to tar):
fsarchiver savedir /data/linux-sources.fsa /usr/src/linux
* save a filesystem (/dev/sda1) to an archive split into volumes of 680MB:
fsarchiver savefs -s 680 /data/myarchive1.fsa /dev/sda1
* save a filesystem and exclude all files/dirs called 'pagefile.*':
fsarchiver savefs /data/myarchive.fsa /dev/sda1 --exclude='pagefile.*'
* generic exclude for 'share' such as '/usr/share' and '/usr/local/share':
fsarchiver savefs /data/myarchive.fsa --exclude=share
* absolute exclude valid for '/usr/share' but not for '/usr/local/share':
fsarchiver savefs /data/myarchive.fsa --exclude=/usr/share
* save a filesystem (/dev/sda1) to an encrypted archive:
fsarchiver savefs -c mypassword /data/myarchive1.fsa /dev/sda1
* same as before but prompt for password in the terminal:
fsarchiver savefs -c - /data/myarchive1.fsa /dev/sda1
* extract an archive made of simple files to /tmp/extract:
fsarchiver restdir /data/linux-sources.fsa /tmp/extract
* show information about an archive and its filesystems:
fsarchiver archinfo /data/myarchive2.fsa
```
]]>很久以前的笔记了
Ubuntu/Debian Manual Install
# Install dependencies
sudo apt-get install git python-appindicator python-xdg python-pexpect python-gconf python-gtk2 python-glade2 libxxf86vm1
# Download fluxgui
cd /tmp
git clone "https://github.com/xflux-gui/fluxgui.git"
cd fluxgui
python download-xflux.py
# EITHER install globally
sudo python setup.py install
# EXCLUSIVE OR, install in your home directory. The binary installs
# into ~/.local/bin, so be sure to add that to your PATH if installing locally.
python setup.py install --user
# Run flux
fluxgui
Ubuntu/Debian Manual Uninstall
If you manually installed instead of using the PPA, you can uninstall by making setup.py tell you where it installed files and then removing the installed files.
# EITHER uninstall globally
sudo python setup.py install --record installed.txt
sudo xargs rm -vr < installed.txt
# EXCLUSIVE OR uinstall in your home directory
python setup.py install --user --record installed.txt
xargs rm -vr < installed.txt
]]>backup是一款强大的备份软件,用于系统备份、增量备份、远程备份,企业级。
我还是当年使用debian时用过...这是以前的笔记,留一份在这好了。
软件安装(debian 9)
apt-get install backuppc
然后会弹窗:
backuppc设定
管理web地址:
http://lonelyor/backuppc
user:backuppc
passwd:u6oN2KE1
可以通过运行htpasswd /etc/backuppc/htpasswd来修改密码
这些信息要记住!
安装后:
Creating config file /etc/backuppc/config.pl with new version(可以暂时忽略)
然后运行:
systemctl restart apache2
/etc/init.d/backuppc restart
接着就打开浏览器访问:
http://lonelyor/backuppc
就能看到web管理界面了。
如果进不去可以打开隐身模式或者清除cookie再试。
官方安装文档:http://backuppc.sourceforge.net/BackupPC-4.1.3.html#Installing-BackupPC
参考文档:
http://server.zol.com.cn/513/5130348.html
运行 service v2ray start 来启动 V2Ray 进程;
之后可以使用 service v2ray start|stop|status|reload|restart|force-reload 控制 V2Ray 的运行。
v2ray官网:
https://www.v2ray.com/chapter_00/install.html
v2ray一键安装:
bash <(curl -L -s https://install.direct/go.sh)
ssh -D 1085 -p 6754 root@xx.xx.xx.xx如果不稳定,可以考虑使用autossh。
]]>大佬还提供了一个更有意思的方法,将list1和list2做成一个list,然后将其打乱,再扫描。(骚思路就像好算法,是编程的精髓。)
]]>编辑(没有就创建)配置文件
nano ~/.nanorc
然后添加以下内容
# 语法高亮
include "/usr/share/nano/*.nanorc"
或者
# 语法高亮
include "/usr/local/share/nano/*.nanorc"
这里include哪一个主要取决于nanorc的具体位置。通常linux在share,macosx在local/share。
其他内容如:
# 启用行号
set linenumbers
# 平滑滚动
set smooth
# 自动缩进
set autoindent
# tab为空格
set tabstospaces
# 启用鼠标
set mouse
然后保存,重新打开终端,即可发现设置生效,以上方法适用于linux和macosx。
]]>举例:
df -k 以KB为单位显示磁盘使用量和占用率。
df -k 以M×××
使用“du -ck /home”命令,列出home目录下所有文件或目录占用的大小,以KB作为计量单位。以及统计出当前home目录占用的总大小。
]]>文章参考自:http://blog.csdn.net/xiaochuige/article/details/49252741 感谢作者。
crontab的基本格式:
* * * * * command
几个星号分别为:分 时 日 月 周,最后是要执行的命令。
分:0~59
时:0~23
日:1~31
月:1~12
周:0~6(0表示星期天)
除了数字还有几个个特殊的符号就是* / - :
* 代表所有的取值范围内的数字
/ 代表每的意思
*/5 表示每5个单位
- 代表从某个数字到某个数字
, 分开几个离散的数字
配置文件的一些例子:
0 3 * * * /root/test.sh 每天凌晨3点执行test.sh文件
* 23-7/1 * * * /root/lnmp restart 晚上11点到早上7点之间,每隔一小时重启lnmp套件
*/30 * * * * /usr/sbin/ntpdate 每半小时同步一下时间
0 23 * * 6 /lnmp restart 每星期六的11 : 00 pm重启重启lnmp套件。
*/1 * * * * echo "i am running.">>/tmp/running.txt 每隔1分钟向/tmp/running.txt写一个"i am running."字符串。
运行
我以为编辑crontab保存后会自动执行,其实不然,必须通过重启cron才可以,命令如下:
启动/etc/init.d/cron start
关闭/etc/init.d/cron stop
重启/etc/init.d/cron restart
apm config set http-proxy socks5:127.0.0.1:1080
apm config set https-proxy socks5:127.0.0.1:1080
apm config set strict-ssl false
apm config set http-proxy null
apm config set https-proxy null
apm config get http-proxy
apm config get https-proxy
编辑~/.atom/.apmrc文件,配置为:
strict-ssl=false
http_proxy = socks5: 127.0.0.1:1080
https_proxy = socks5: 127.0.0.1:1080