Closed joelin109 closed 2 years ago
osx的软件管理工具, z.B. NPM for NodeJS
(http://brew.sh/)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Run these two commands in your terminal to add Homebrew to your PATH:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/joelin109/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
echo >> 使用>>定向符 输出到一个文件
Run brew help
to get started
brew help
brew --version
brew install
brew list 或brew ls 列出已安装的软件包 (/opt/homebrew/Cellar)
brew install wget
brew install redis
redis-server -v
redis-cli ping
127.0.0.1:6379> AUTH PASSWORD 127.0.0.1:6379> CONFIG SET requirepass "myredispassword" 127.0.0.1:6379> AUTH myredispassword
or
opt/homebrew/etc/redis.conf
uncomment line # requirepass foobared, then restart server now password is foobared
- start/stop Redis server
brew services start redis brew services stop redis brew services restart redis
redis-cli 127.0.0.1:6379> exit
- JavaScript Code
PSUBSCRIBE可以监听键的过期事件. 使用命令监听事件(psubscribe keyevnet@0:expired)
const redis = require('redis'); const client = redis.createClient({host: 127.0.0.1, port: 6379, db: 2}); const subClient = redis.createClient({host: 127.0.0.1, port: 6379, db: 2}); subClient.psubscribe('keyevent@2:expired');
client.set(key, value, 'EX', 60 60 24); client.get(key); client.del(key); client.expire(key, expire_time);
subClient.on("pmessage", function(pattern, channel, expiredKey){ console.log(channel + ': key [' + expiredKey + '] has expired'); });
- Python Code
import redis from embo import app
pool = redis.ConnectionPool( host=app.config["REDIS_HOST"], port=app.config["REDIS_PORT"], db=app.config["REDIS_DATABASE"], password=app.config["REDIS_PASSWORD"], decode_responses=True ) Redis = redis.StrictRedis(connection_pool=pool)
def zadd_compatible(name, *args): if not Redis.exists(name): return try: Redis.zadd(name, dict(zip(args[1::2], args[::2]))) except: Redis.delete(name)
- Redis的消息发布(publish)/ 订阅(subscribe)
SUBSCRIBE channel [channel …] / 订阅给定的一个或多个频道的信息 PSUBSCRIBE pattern [pattern …] / 订阅一个或多个符合给定模式的频道 PUBSUB subcommand [argument [argument …] / 查看订阅与发布系统状态 PUBLISH channel message / 将消息发送到指定的频道
˜ % `vim .bash_profile`
˜ % `i` 进行编辑
˜ % `esc` 结束编辑;
˜ % `:`
˜ % `wq` 存储离开
˜ % `q` 离开
What I need install
brew upgrade git
,brew install git
brew install curl
vim .bash_profile
export PATH=$PATH:/Applications/CMake.app/Contents/bin
1.17 or later
vim .bash_profile
export GOROOT=/usr/local/go export GOPATH=/Volumes/Mac-TBD/Server/Golang/external export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
14.0 or later
pip3 install -U -pip
npm view [package] version
,npm uninstall -g [package]
sudo gem install cocoapods