diff --git a/mongodb/auth.md b/mongodb/auth.md index c2b2cb2..6b16b47 100644 --- a/mongodb/auth.md +++ b/mongodb/auth.md @@ -5,11 +5,32 @@ $ mongo > show dbs > use admin > db.createUser({ - user: "light", - pwd: "123456", + user: "root", + pwd: "root", roles: [ { role: "userAdminAnyDatabase", db: "admin" }] } ) + +use test +db.createUser( + { + user: "tester", + pwd: "xyz123", + roles: [ { role: "readWrite", db: "test" }, + { role: "read", db: "reporting" } ] + } +) + +roles: +readWrite +read + +readAnyDatabase 任何数据库的只读权限 + +readWriteAnyDatabase 任何数据库的读写权限 + +userAdminAnyDatabase 任何数据库用户的管理权限 +dbAdminAnyDatabase 任何数据库的管理权限 ``` # role diff --git a/mongodb/use.md b/mongodb/use.md new file mode 100644 index 0000000..9158baf --- /dev/null +++ b/mongodb/use.md @@ -0,0 +1,16 @@ +# mongodb 一般使用命令 + +``` bash +sudo service mongod restart + + +``` + +``` mongodb + +use admin + +db.system.users.find() +db.system.users.remove({}) + +``` \ No newline at end of file diff --git a/python/virtualenv.md b/python/virtualenv.md index 23dd252..86dfab3 100644 --- a/python/virtualenv.md +++ b/python/virtualenv.md @@ -1,4 +1,6 @@ # virtualenv not -> virtualenv --system-site-packages venv \ No newline at end of file +> virtualenv -p /usr/bin/python3 --system-site-packages venv + +> virtualenv -p /usr/bin/python2 --no-site-packages venv \ No newline at end of file diff --git a/raspberry/sound.md b/raspberry/sound.md new file mode 100644 index 0000000..92ffaf4 --- /dev/null +++ b/raspberry/sound.md @@ -0,0 +1,11 @@ +# 树莓派播放声音 + +## 调整声音大小 + +> alsamixer + +## 播放音频 + +> omxplayer ***. +> mplayer /home/pi/project/SoundPlayer/static/alert.wav +> omxplayer /home/pi/project/SoundPlayer/static/alert.wav \ No newline at end of file diff --git a/raspberry/wifi.md b/raspberry/wifi.md new file mode 100644 index 0000000..492152a --- /dev/null +++ b/raspberry/wifi.md @@ -0,0 +1,12 @@ +# 树莓派连接wifi + +# 命令行 + +> sudo nano /etc/wpa_supplicant/wpa_supplicant.conf + +``` bash +network={ + ssid="The_ESSID_from_earlier" + psk="Your_wifi_password" +} +``` \ No newline at end of file diff --git a/redis/配置.md b/redis/配置.md new file mode 100644 index 0000000..250c7a4 --- /dev/null +++ b/redis/配置.md @@ -0,0 +1,81 @@ +# redis 安装配置 + +## 安装 + +``` bash +cd /srv +wget http://download.redis.io/releases/redis-4.0.1.tar.gz +tar xzf redis-4.0.1.tar.gz +cd redis-4.0.1 +make +make test +``` + +## 配置 + +``` bash +sudo ln -s /srv/redis-4.0.1/src/redis-server /usr/local/bin/ +sudo ln -s /srv/redis-4.0.1/src/redis-cli /usr/local/bin/ +mkdir /etc/redis +cp /srv/redis-4.0.1/redis.conf /etc/redis +#修改redis.conf(/etc/redis下) +#打开后台运行选项 +daemonize yes +#设置日志文件路径 +logfile"/var/log/redis/redis.log" +``` + +> nano /etc/init.d/redis + +``` bash +#!/bin/sh +# chkconfig: 2345 10 90 +# description: Start and Stop redis + +PATH=/usr/local/bin +REDISPORT=6379 +EXEC=/usr/local/bin/redis-server +REDIS_CLI=/usr/local/bin/redis-cli +PIDFILE=/var/run/redis_6379.pid +CONF="/etc/redis/redis.conf" + +case "$1" in + start) + if [ -f $PIDFILE ] + then + echo "$PIDFILE exists, process is already running or crashed." + else + echo "Starting Redis server..." + $EXEC $CONF + fi + if [ "$?"="0" ] + then + echo "Redis is running..." + fi + ;; + stop) + if [ ! -f $PIDFILE ] + then + echo "$PIDFILE exists, process is not running." + else + PID=$(cat $PIDFILE) + echo "Stopping..." + $REDIS_CLI -p $REDISPORT SHUTDOWN + while [ -x $PIDFILE ] + do + echo "Waiting for Redis to shutdown..." + sleep 1 + done + echo "Redis stopped" + fi + ;; + restart|force-reload) + ${0} stop + ${0} start + ;; + *) + echo "Usage: /etc/init.d/redis {start|stop|restart|fore-reload}" + exit 1 +esac + +``` diff --git a/ubuntu/scp.md b/ubuntu/scp.md new file mode 100644 index 0000000..4fe832a --- /dev/null +++ b/ubuntu/scp.md @@ -0,0 +1 @@ +scp -P 2210 -r static pi@myserver:/home/pi/