0%

loop with seq

#!/bin/bash

for n in seq 1 3 100
do
echo $n
done

loop find mv

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/bash

for i in {1..14}
do
# echo $i
# echo 'map_'$i'*.png'

# find . -maxdepth 1 -regex '.*map_'$i'.*'


# find . -name 'map_'$i'*.png'

echo map_$i-*.png
mv map_$i-*.png 222

done

ls only folder

ls -d */

/ is a pattern that matches all of the subdirectories in the current directory ( would match all files and subdirectories; the / restricts it to directories). Similarly, to list all subdirectories under /home/alice/Documents, use ls -d /home/alice/Documents/*/

查找系统中所有文件长度为0的普通文件,并列出它们的完整路径

find / -type f -size 0 -exec ls -l {} ;

vi .bash_profile

alias lf=”ls -l | egrep -v ‘^d’”
alias ldir=’ls -d */‘

lf 只显示文件
ldir 只显示目录

ctrl+a 到开头
ctrl+e 到结尾

esc+b 向后(左)一个单词
esc+f 向前(右)一个单词

设置 iTerm2 的 preferences 的 keys

⌘← send ^[b
⌘→ send ^[f

gem source

sass 出错,重装

sudo gem install sass

报告 ssl 错误!因为: 之前淘宝的源已经无法使用

  1. 查看gem源

gem source -l

  1. 删除源

gem source -r <源地址>

3.添加源

gem sources –add https://gems.ruby-china.com


$ gem update –system # 这里请翻墙一下
$ gem -v
2.6.3

$ gem sources –add https://gems.ruby-china.com/ –remove https://rubygems.org/
$ gem sources -l
https://gems.ruby-china.com

确保只有 gems.ruby-china.com

如何搭建 https

mac 删除 顽固文件

跑程序,跑出了 超过256层嵌套的目录!!回收站无法删除

rm -R [把 trash 里面的目录拖进 终端窗口]


Type of copy the following into Terminal: sudo rm -R (there needs to be a space after the R)
But don’t press enter.
Now Control-click on your Trash icon to open it.
Select the files in your trash.
Drag them to the Terminal window.
Now press Enter
Enter your administrator password (it won’t show up)
Hit Enter

via

https://www.macworld.co.uk/how-to/mac/how-empty-trash-on-mac-3682422/

https://www.imore.com/how-force-empty-trash-your-mac-using-terminal

var view = map.getView();
var vs = layer_tile.getSource();

console.log(map.getSize());
console.log(vs.getExtent());
console.log(view.getResolution());

  • extent view 18

分辨率: 2.388657133911758 zoom 是: 16

分辨率: 0.5971642834779395 zoom 是: 18

var mm = map.getView().getResolution()/0.5971642834779395;
var sizearr = map.getSize();
var rs = [sizearr[0]*mm,sizearr[1]*mm];

没有 telnet

1
brew install telnet

不行,再尝试

1
2
3
xcode-select --install
brew tap theeternalsw0rd/telnet
brew install telnet

星球大战

1
towel.blinkenlights.nl

或者

1
nc towel.blinkenlights.nl 23

mac apache folder

/etc/apache2

homebrew

报错。需要 chown /usr/local 然后报错 不能完成

1
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
1
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

mac install pip

1
2
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo python get-pip.py

via https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py

sudo pip install requests

or

sudo pip3 install requests

升级

sudo pip3 install –upgrade pip

台湾岛旅游网

台北

国父纪念馆
101大楼-宁夏夜市
士林官邸
台北故宫
阳明山国家公园
诚品信义

台北总统府 - 中正纪念堂 - 士林官邸 - 台北故宫博物院

西门町 艋舺

花莲

普悠瑪 太魯閣 是快车

鐵路:從台北車站搭普悠瑪號列車(2-2.5小時).太魯閣號列車(2.5-3小時).自強號列車(2.5-3.5小時看班次).以上三種型列車皆為自強號票價但是以普悠瑪號列車為最快但是不出售站票..但是自強號列車有站票.

太鲁阁国家公园+七星潭+清水断崖
出海赏鲸豚

2天足够,半天去赏鲸,半天去太鲁阁,半天去七星潭。

====

高铁官网: https://irs.thsrc.com.tw
台铁官网: http://railway.hinet.net

http://www.mafengwo.cn/sales/2172008.html?cid=1010402&sourceFrom=zhuti-12684-12000

http://www.mafengwo.cn/sales/2171948.html?cid=1010402&sourceFrom=zhuti-12684-12000

提前到可刷票进站,乘坐前面车次(不足半小时一趟车)的自由座不用久等,如果晚了一个小时就坐原来车次不用怕迟到。不过享受早鸟折扣票的谨慎使用此技巧,最好不要被工作人员发现,否则未乘坐原定车次需要按全价补齐差价。

台北-垦丁 高铁台北到左营(高雄)2-2.5小时 快线巴士 垦丁大街 2小时
花莲-垦丁 台铁到枋寮 快线巴士 垦丁大街 1小时

台北站 桃园机场 捷运(国内叫地铁) 35-40分钟

1.台北佳德糕饼(这是我最爱的,他们家的太阳饼和绿豆糕也好吃得不要不要的!)

.糖村(这好像是最有名的一家,他们家法式原味确实很棒,就买原味就对了。重要的事情说三遍,草莓味儿的很难吃很难吃很难吃,不要买不要买不要买。)

台北林华泰茶行
这家店是台北的百年老茶叶店,门脸十分简陋,特别有一种国营老字号的赶脚。去这儿买茶的都是台湾本地人和日本人,亲测比猫空的茶性价比高。
推荐茶叶:①高山乌龙,比冻顶乌龙好喝。②金萱,比起高山乌龙有些奶味。
包装是半斤打成一个真空包装。台湾的1斤是600g。

1.森田面膜&眼膜(绝对草鸡便宜且好用,其他品牌跟它比都被秒成渣。这次去买下来相当于4元/片,自己感受。)

2.宠爱之名(是台湾本土化妆品,所以在这里买最划算。)

3.所有日妆或日本产药物(如果你近期不去日本,那在这里买特别合适,包括各种洗面皂,狮王眼药水和FX眼药水。)

4.强烈需要推荐的单品:如果经常关注美妆的姑娘应该知道SOFINA妆前乳(对就是各种美妆达人都推荐的那个)。是日产的,但是在台湾买台版的比在日本买便宜好多好多好多!日本买折合200+人民币一瓶,台湾买无论是康是美还是屈臣氏,折合70人民币一瓶,大家自己看着来吧~)

docker shadowsocks

docker run -d
-e METHOD=aes-256-gcm
-e PASSWORD=123456
–name=gsssr
-p 8388:8388/tcp
-p 8388:8388/udp
–restart=always
acrisliu/shadowsocks-libev

Server

Install

Debian / Ubuntu:

apt-get install python-pip
pip install git+https://github.com/shadowsocks/shadowsocks.git@master

CentOS:

yum install python-setuptools && easy_install pip
pip install git+https://github.com/shadowsocks/shadowsocks.git@master

For CentOS 7, if you need AEAD ciphers, you need install libsodium

1
2
dnf install libsodium python34-pip
pip3 install git+https://github.com/shadowsocks/shadowsocks.git@master

Linux distributions with snap:

snap install shadowsocks

Windows:

See Install Shadowsocks Server on Windows.

Usage

ssserver -p 443 -k password -m aes-256-cfb

To run in the background:

sudo ssserver -p 443 -k password -m aes-256-cfb --user nobody -d start

To stop:

sudo ssserver -d stop

To check the log:

sudo less /var/log/shadowsocks.log

Check all the options via -h. You can also use a [Configuration] file
instead.

If you installed the snap package, you have to prefix the commands with shadowsocks.,
like this:

shadowsocks.ssserver -p 443 -k password -m aes-256-cfb

Usage with Config File

Create configuration file and run

To start:

ssserver -c /etc/shadowsocks.json

Documentation

You can find all the documentation in the Wiki.

install git

1
yum install git

check

1
git --version

git version 1.8.3.1

server side

1
2
3
cd /home
mkdir myrepo
git init --bare /home/myrepo/gs.git

client side

git clone root@blog.guoshuang.com:/home/myrepo/gs.git

git add .

git commit -m ‘hi,test’
git push

hooks

cd hooks

创建post-receive文件

vim post-receive

输入以下内容

1
2
#!/bin/bash
git --work-tree=/home/guoshuang/nginx/html/blog checkout -f
1
chmod +x post-receive

-https://juejin.im/post/5c7e4e43f265da2d980923a6
-https://www.digitalocean.com/community/tutorials/how-to-create-a-blog-with-hexo-on-ubuntu-14-04

Package ControlUnable to download Sass. Please view the console for more details.

删除包控制器,然后重装。

deleted the ~/.config/sublime-text-3/Packages/Package Control folder and the
~/.config/sublime-text-3/Installed Packages/Package Control.sublime-package file and reinstalled the package manager. Now it’s working again.

重装

https://packagecontrol.io/installation#st2

via

https://upcloud.com/community/tutorials/wordpress-with-docker/

图形界面 配置网络 dhcp

1
nmtui
1
yum update && yum upgrade
1
2
systemctl start httpd.service
# systemctl enable httpd.service
1
2
3
firewall-cmd --permanent --add-service=http
# systemctl restart firewalld
systemctl restart httpd.service

sudo systemctl stop firewalld

or

systemctl disable firewalld

aili mirrors

http://mirrors.aliyun.com/centos/7/isos/x86_64/

1
2
3
4
5
6
7
8
9
10
11
sudo yum update httpd

sudo yum install httpd

sudo systemctl start httpd

sudo systemctl status httpd

sudo systemctl restart httpd

sudo systemctl enable httpd

/etc/init.d/network restart

======

sudo vi /etc/httpd/conf/httpd.conf

sudo vi /etc/httpd/sites-available/example.com.conf

<VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com
DocumentRoot /var/www/example.com/html
ErrorLog /var/www/example.com/log/error.log
CustomLog /var/www/example.com/log/requests.log combined