Last active
December 25, 2021 12:41
-
-
Save kennyz/4748807 to your computer and use it in GitHub Desktop.
Revisions
-
kennyz revised this gist
Jun 7, 2013 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -189,8 +189,9 @@ pi@raspberrypi ~/downloads $ dd count=50 bs=1M if=/dev/zero of=~/test.img bingo!! ## 解决初始安装时,键盘输入奇怪符号的问题 比如输入`|`,则显示`~` 主要原因是键盘默认使用GB(英国)键盘。 打开 /etc/default/keyboard 修改 gb 为 us即可 -
kennyz revised this gist
Jun 7, 2013 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -188,5 +188,9 @@ pi@raspberrypi ~/downloads $ dd count=50 bs=1M if=/dev/zero of=~/test.img bingo!! ## 解决初始安装时,键盘输入奇怪符号的问题 比如输入`|`,责显示`~` 主要原因是键盘默认使用GB(英国)键盘。 打开 /etc/default/keyboard 修改 GB 为 US即可 -
kennyz revised this gist
Feb 11, 2013 . 1 changed file with 18 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -31,7 +31,14 @@ mkdir /media/usbdisk/mactimebak 步骤如下: ### 1)安装pptpd 运行 `sudo modprobe ppp-compress-18` 看内核是否支持,如果没有出错,可以继续。 安装pptpd服务: `sudo apt-get install pptpd` 然后开始配置 `sudo vim /etc/pptpd.conf` @@ -42,9 +49,12 @@ remoteip 192.168.1.234-238,192.168.1.245 `sudo vim /etc/ppp/chap-secrets` 增加如下行: ``` vpnuser pptpd vpnpwd * ``` 这里的vpnuser和vpnpwd改为你自己要设置的用户名密码。 `sudo vim /etc/ppp/pptpd-options` 配置改为: @@ -57,6 +67,9 @@ mtu 1396 mru 1396 ``` 这个地方折腾了我很长时间,配置了各种DNS服务,都会出现有些网站无法访问的情况。最后用Google的DNS,一切就好了。 希望这个提示可以帮助大家少走些弯路。 配置改好了,运行 `sudo /etc/init.d/pptpd restart` 启动服务 @@ -65,10 +78,14 @@ mru 1396 /etc/sysctl.conf 修改 `net.ipv4.ip_forward=1` 然后运行 `sudo sysctl -p` 使配置生效。 在路由器上设置 `1723` 端口转发到pi上,如果pi有防火墙就打开这个端口。 ### 3)好了 在客户端配置vpn(选择PPTP)就可以联通VPN了。 ## 实现微信控制Pi上的音乐播放 稍微有点复杂,慢慢写... -
kennyz revised this gist
Feb 11, 2013 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -29,7 +29,7 @@ mkdir /media/usbdisk/mactimebak 当然在pi上搞个VPN服务,还是有很多好处的,你懂的。 步骤如下: ### 1)安装pptpd `sudo modprobe ppp-compress-18` @@ -61,14 +61,14 @@ mru 1396 `sudo /etc/init.d/pptpd restart` 启动服务 ### 2)配置网络 /etc/sysctl.conf 修改 `net.ipv4.ip_forward=1` 在路由器上设置 `1723` 端口转发到pi上,如果pi有防火墙就打开这个端口。 ### 3)好了 在客户端配置vpn(选择PPTP)就可以联通VPN了 ## 实现微信控制Pi上的音乐播放 稍微有点复杂,慢慢写... -
kennyz revised this gist
Feb 11, 2013 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -57,13 +57,15 @@ mtu 1396 mru 1396 ``` 配置改好了,运行 `sudo /etc/init.d/pptpd restart` 启动服务 ### 配置网络 /etc/sysctl.conf 修改 `net.ipv4.ip_forward=1` 在路由器上设置 `1723` 端口转发到pi上,如果pi有防火墙就打开这个端口。 ### 好了 -
kennyz revised this gist
Feb 11, 2013 . 1 changed file with 36 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ ## 折腾Pi,解决疑难杂症最好还是去官网论坛  [http://www.raspberrypi.org/phpBB3/]() ## 支持Apple TimeMachine,实现Mac备份 @@ -31,8 +31,42 @@ mkdir /media/usbdisk/mactimebak 步骤如下: ### 安装pptpd `sudo modprobe ppp-compress-18` `sudo vim /etc/pptpd.conf` ``` localip 192.168.1.10 remoteip 192.168.1.234-238,192.168.1.245 ``` `sudo vim /etc/ppp/chap-secrets` ``` vpnuser pptpd vpnpwd * ``` `sudo vim /etc/ppp/pptpd-options` 配置改为: ``` ms-dns 8.8.8.8 ms-dns 8.8.4.4 noipx nodefaultroute mtu 1396 mru 1396 ``` ### 配置网络 /etc/sysctl.conf 修改 `net.ipv4.ip_forward=1` 打开防火墙 `1723` 端口 ### 好了 ## 实现微信控制Pi上的音乐播放 稍微有点复杂,慢慢写... -
kennyz revised this gist
Feb 11, 2013 . 1 changed file with 10 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -24,6 +24,16 @@ mkdir /media/usbdisk/mactimebak ## 如何在家庭宽带上实现动态域名,让pi成为一个真实的网站 写在另外一个页面里了 [https://gist.github.com/kennyz/0afc809baabd8223fddf] ## 给pi配置VPN 有时候需要远程连接到pi上去用samba编辑本地代码,这该死的samba又死活只支持局域网,逼得我连vpn进来。 当然在pi上搞个VPN服务,还是有很多好处的,你懂的。 步骤如下: ### 安装pptpd ### 配置网络 ### 配置VPN客户端 ## 实现微信控制Pi上的音乐播放 稍微有点复杂,慢慢写... -
kennyz revised this gist
Feb 11, 2013 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,6 @@ ## 折腾Pi,解决疑难杂症最好的地方还是Raspberry Pi的官网论坛  [http://www.raspberrypi.org/phpBB3/]() ## 支持Apple TimeMachine,实现Mac备份 在磁盘中创建备份目录 mkdir /media/usbdisk/mactimebak @@ -25,10 +28,13 @@ mkdir /media/usbdisk/mactimebak 稍微有点复杂,慢慢写... ## 安装看门狗防止pi死机 参考文章 [Link](http://ukonline2000.com/?p=116) ## 在Pi上增加负载和CPU温度的监控 将Pi的负载和温度显示在你自己的网站上,愿意自己绘图的可以自己动手,像我一样懒的可以通过COSM的API实时接收数据并且画出精美的监控图片。 比如这样的:  send_data.sh 的代码如下: -
kennyz revised this gist
Feb 11, 2013 . No changes.There are no files selected for viewing
-
kennyz revised this gist
Feb 11, 2013 . 1 changed file with 6 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ ## 支持Apple TimeMachine,实现Mac备份 在磁盘中创建备份目录 mkdir /media/usbdisk/mactimebak 推荐使用ext4分区(打开notime) @@ -18,12 +18,15 @@ mkdir /media/usbdisk/mactimebak /media/usbdisk/mactimebak "Time Machine" allow:pi cnidscheme:dbd options:usedots,upriv,tm ``` ## 如何在家庭宽带上实现动态域名,让pi成为一个真实的网站 写在另外一个页面里了 [https://gist.github.com/kennyz/0afc809baabd8223fddf] ## 实现微信控制Pi上的音乐播放 稍微有点复杂,慢慢写... ## 安装看门狗防止pi死机 参考文章 [http://ukonline2000.com/?p=116] ## 在Pi上增加负载和CPU温度的监控 -
kennyz revised this gist
Feb 10, 2013 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,10 +18,11 @@ mkdir /media/usbdisk/mactimebak /media/usbdisk/mactimebak "Time Machine" allow:pi cnidscheme:dbd options:usedots,upriv,tm ``` ### 如何在家庭宽带上实现动态域名,让pi成为一个真实的网站 写在另外一个页面里了 [https://gist.github.com/kennyz/0afc809baabd8223fddf] ### 实现微信控制Pi上的音乐播放 稍微有点复杂,慢慢写... ## 在Pi上增加负载和CPU温度的监控 -
kennyz revised this gist
Feb 10, 2013 . 1 changed file with 20 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,24 @@ ### 支持Apple TimeMachine,实现Mac备份 在磁盘中创建备份目录 mkdir /media/usbdisk/mactimebak 推荐使用ext4分区(打开notime) 安装nettalk 修改配置文件: `sudo vim /etc/netatalk/AppleVolumes.default` 配置如下 ``` # The line below sets some DEFAULT, starting with Netatalk 2.1. :DEFAULT: options:upriv,usedots # By default all users have access to their home directories. ~/ "Home Directory" /media/usbdisk/mactimebak "Time Machine" allow:pi cnidscheme:dbd options:usedots,upriv,tm ``` ### 实现微信控制Pi上的音乐播放 ... -
kennyz revised this gist
Feb 10, 2013 . No changes.There are no files selected for viewing
-
kennyz revised this gist
Feb 10, 2013 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,8 @@ ### 支持Apple TimeMachine,实现Mac备份 ... ### 实现微信控制Pi上的音乐播放 ... ## 在Pi上增加负载和CPU温度的监控 @@ -92,3 +97,4 @@ pi@raspberrypi ~/downloads $ dd count=50 bs=1M if=/dev/zero of=~/test.img bingo!! -
kennyz created this gist
Feb 10, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,94 @@ ## 在Pi上增加负载和CPU温度的监控 send_data.sh 的代码如下: ``` cd /home/pi/bin/cosm/ sed 's/\([0-9]*\.[0-9][0-9]\) \([0-9]*\.[0-9][0-9]\) \([0-9]*\.[0-9][0-9]\)\(.*\)/{"datastreams":[ {"id":"5min","current_value":"\1"},{"id":"10min","current_value":"\2"},{"id":"15min","current_value":"\3"} ]}/' /proc/loadavg > cosm-load.json curl --request PUT --data-binary @cosm-load.json --header "X-ApiKey: -APIKEY" http://api.cosm.com/v2/feeds/95397?timezone=+8 VAL=`cat /sys/class/thermal/thermal_zone0/temp` STR=`awk 'BEGIN{printf "{\"datastreams\":[ {\"id\":\"temp\",\"current_value\":\"%.1f\"} ] } ",'$VAL'/1000}'` echo $STR > cosm_temp.json curl --request PUT --data-binary @cosm_temp.json --header "X-ApiKey: -APIKEY" http://api.cosm.com/v2/feeds/95397?timezone=+8 ``` ## 更换了一个更加快速的源: pi的源列表: [http://www.raspbian.org/RaspbianMirrors]() 测试了之后发现这个源在国内更新最快 `http://mirror.devunt.kr/raspbian/raspbian/` 更换源: sudo vi /etc/apt/sources.list 更换为以下代码: `deb http://mirror.devunt.kr/raspbian/raspbian/ wheezy main contrib non-free rpi` ## 解决磁盘速度问题 **外接磁盘绝对不能使用NTFS格式分区!速度非常慢** 安装测试磁盘速度的软件: `sudo apt-get install hdparm` 测试本地card的读写速度: `hdparm -Tt /dev/mmcblk0` `pi@raspberrypi ~/downloads $ sudo hdparm -Tt /dev/mmcblk0` ``` /dev/mmcblk0: Timing cached reads: 210 MB in 2.02 seconds = 104.21 MB/sec Timing buffered disk reads: 54 MB in 3.09 seconds = 17.45 MB/sec pi@raspberrypi ~/downloads $ dd count=50 bs=1M if=/dev/zero of=~/test.img 50+0 records in 50+0 records out 52428800 bytes (52 MB) copied, 1.55218 s, 33.8 MB/s ``` 测试外接硬盘的读写速度: `hdparm -Tt /dev/sda1` `pi@raspberrypi ~/downloads $ sudo hdparm -Tt /dev/sda1` ``` /dev/sda1: Timing cached reads: 316 MB in 2.01 seconds = 157.46 MB/sec Timing buffered disk reads: 62 MB in 3.03 seconds = 20.48 MB/sec ``` `pi@raspberrypi ~/downloads $ dd count=50 bs=1M if=/dev/zero of=/media/usbdisk/test.img` ``` 50+0 records in 50+0 records out 52428800 bytes (52 MB) copied, 13.5962 s, 3.9 MB/s ``` 将external disk 格式化成ext4 `sudo mount -t ext4 /dev/sda1 /media/usbdisk` `pi@raspberrypi / $ sudo dd count=50 bs=1M if=/dev/zero of=/media/usbdisk/test.img` ``` 50+0 records in 50+0 records out 52428800 bytes (52 MB) copied, 1.15549 s, 45.4 MB/s ``` bingo!!