2015年6月26日星期五

使用Windows Live Writer在Blogger上写博客

    启用了两步验证的话,只要在https://security.google.com/settings/security/apppasswords里为Windows Live Writer申请一个新的应用密码就行了。select app选择others,名字起为Windows Live Writer,点击generate,将产生的密码作为登陆密码就行了。

image

使用私钥ssh登陆centos

首先下载PuTTY:
http://the.earth.li/~sgtatham/putty/latest/x86/putty.zip
解压之后运行PuTTYge.exe:
image
Type of key to generate 选择SSH-2 RSA, Number of bits in a generated key选择2048或者4096 。然后点击Generate。
image
在上面的空白区域滑动鼠标直到进度条满。然后密钥就生成了。
image
Key comment可以填一下密钥的标识信息,随便填。
Key passphrase可填可不填,如果填了,使用密钥ssh登陆时还要输入它。填了安全性更好,而且要记住。
然后点击Save private key,命名可以为privatekey.ppk一定要存在一个安全的地方,别弄丢了,最好做好备份。公钥可以不保存。
将Public key for pasting into OpenSSH authorized_keys file文本框里的文字全部选择,复制,待会儿会用到。
之后以root身份ssh到centos上:
cd ~
mkdir .ssh
cd .ssh
touch authorized_keys
vi authorized_keys
将刚才复制的内容粘贴进去,保存。之后更改权限:
chmod 600 authorized_keys
cd ..
chmod 700 .ssh
restorecon -Rv /root/.ssh
再修改/etc/ssh/sshd_config文件:
PermitRootLogin yes
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile  .ssh/authorized_keys
PasswordAuthentication no  #这个最好密钥登陆成功后再修改
保存之后重启sshd服务:
service sshd restart
之后就是设置PuTTY了,打开PuTTY.exe
image
填好ip和端口
image
填好自动登陆用户名
image
导入私钥。

之后记得保存设置:

image
之后就可以登陆试试了。应该是可以的。

vps修改SSH端口和禁止Root远程登陆

以centos为例:
先添加一个普通用户:
useradd username
passwd username
之后
vi /etc/ssh/sshd_config
将port 22前的#号删除,并且将22修改成其他端口,1234之类的。
将PermitRootLogin yes前的#号删除并将yes改为no。
保存之后重启sshd:
service sshd restart

centos下安装配置shadowsocks-libev教程

首先进入/etc/yum.repos.d/:
cd
/etc/yum.repos.d/
接着输入下列命令:
centos6: wget https://copr.fedoraproject.org/coprs/librehat/shadowsocks/repo/epel-6/librehat-shadowsocks-epel-6.repo
centos7: wget https://copr.fedoraproject.org/coprs/librehat/shadowsocks/repo/epel-7/librehat-shadowsocks-epel-7.repo
然后使用yum安装:
yum update
yum install shadowsocks-libev
安装好之后进行配置:
vi
/etc/shadowsocks-libev/config.json
需要修改密码,端口,和加密方式,注意加密方式要加双引号,推荐aes-128-cfb。
之后就可以运行了:

/etc/init.d/shadowsocks-libev start

2015年6月5日星期五

编译安装shadowsocks-libev过程中出现configure: error: OpenSSL header files not found.

解决方法:
The OpenSSL library is usually already installed, but you have to install the header files. Depending on your Linux distribution, you'll need these packages:
  • Red Hat, Fedora, CentOS - openssl-devel
  • Debian, Ubuntu - libssl-dev
  • Arch - openssl

2015年6月4日星期四

emui3.0 换字体(全局)

前提:你的是3.0ui,已经root,安装RE
1、下载自己想要的字体
2、复制3份,分别重命名为:
DroidSansChinese.ttf
DroidSansFallback.ttf
slim.ttf
3、拷贝到手机,用RE复制到 SYSTEM/fonts下(最好先备份原有的字体),重启。  OK

2015年6月2日星期二

生成firefox user.js的简单shell脚本

命令:
printf "user_pref(\"%s\",%s);\n" ` cat filename`
你可以新建一个文本将要修改的项目和参数以下列格式写下来:

a true b false c 100 d 0
然后保存,之后在shell下运行上面的命令,将filename改成文本名。

转:解决yum thread.error: can't start new thread 错误

解决方法:
编辑 /etc/yum/pluginconf.d/fastestmirror.conf
将enabled=1修改为enabled=0

firefox39 user.js

user_pref("accessibility.accesskeycausesactivation",false);
//禁止自动刷新
user_pref("accessibility.blockautorefresh",false);
//浏览器动画
user_pref("browser.download.animateNotifications",false);
user_pref("browser.fullscreen.animateUp",0);
user_pref("browser.panorama.animate_zoom",false);
user_pref("browser.preferences.animateFadeIn",false);
user_pref("browser.tabs.animate",false);
user_pref("layout.animated-image-layers.enabled",false);
//搜索结果新标签页显示
user_pref("browser.search.openintab",true);
//url栏格式
user_pref("browser.urlbar.trimURLs",false);
user_pref("browser.urlbar.formatting.enabled",false);
//扩展兼容性检查
user_pref("extensions.checkCompatibility",false);
//拼写检查
user_pref("layout.spellcheckDefault",2);
//ctrl+tab预览
user_pref("browser.ctrlTab.previews",true);
//在网页中显示一个插入符号,home和end会失灵,f7键控制
user_pref("accessibility.browsewithcaret",true);
user_pref("accessibility.browsewithcaret_shortcut.enabled",true);
user_pref("accessibility.warn_on_browsewithcaret",false);
//
user_pref("accessibility.delay_plugins",true);
user_pref("accessibility.delay_plugin_time",1000);
//即时搜索
user_pref("accessibility.typeaheadfind",false);
//浏览器加速
user_pref("nglayout.initialpaint.delay",100);
user_pref("content.notify.ontimer",true);
user_pref("content.notify.interval",100000);
user_pref("content.interrupt.parsing",true);
user_pref("content.max.tokenizing.time",300000);
user_pref(" content.switch.threshold",100000);
user_pref("network.http.pipelining",true);

user_pref("network.http.proxy.pipelining",true);
//插件防止崩溃
user_pref("dom.ipc.plugins.enabled",false);
user_pref("extensions.blocklist.enabled",false);
//快进快退
user_pref("browser.sessionhistory.max_total_viewers",5);
security.dialog_enable_delay",0);
//弹出窗口数目
user_pref("dom.popup_maximum",2);
//保存dns条目
user_pref("network.dnsCacheEntries",20);
//代理连接
user_pref("network.http.max-persistent-connections-per-server",32);
user_pref("network.http.max-persistent-connections-per-proxy",32);
//tracemonkey
user_pref("javascript.options.jit.content",true);
user_pref("javascript.options.jit.chrome",true);