摘要: 由于个人感觉www.oschina.net的热情更高涨,迁移博客到http://my.oschina.net/u/191928。谢谢。 阅读全文
posted @ 2016-02-22 12:42 格通 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 参考How do I do an HTTPS request with Erlang? 1> application:start(inets). ok 2> application:start(ssl). ok 3> http:request(head, {"https://example.com" 阅读全文
posted @ 2016-02-20 16:42 格通 阅读(445) 评论(0) 推荐(0) 编辑
摘要: 使用linux桌面很久了,一直习惯鼠标左键选中,右健弹出菜单复制粘帖。 没想到linux使用鼠标中间健粘帖,很方便。 参考:Linux鼠标中键复制粘贴之谜【Felix蛋疼科普贴】 用鼠标左键单击待复制文本的开始处,然后右键单击待复制文本的结尾处,此时就已经将其选中,用鼠标中键(即向下点击鼠标滑轮), 阅读全文
posted @ 2016-02-20 15:35 格通 阅读(751) 评论(0) 推荐(0) 编辑
摘要: 1. 来自Scaling Erlang的方法 内核调优: # Increase the ipv4 port range: sysctl -w net.ipv4.ip_local_port_range="1024 65535" # General gigabit tuning: sysctl -w n 阅读全文
posted @ 2016-02-20 15:14 格通 阅读(410) 评论(0) 推荐(0) 编辑
摘要: 这里会收集一些erlang项目,有需可以转。 erlang-bookmarks Scaling Erlang High Performance Erlang - Finding Bottlenecks in a CouchDB Cluster #1 The Zen of Erlang ejabber 阅读全文
posted @ 2016-02-20 15:07 格通 阅读(529) 评论(0) 推荐(0) 编辑
摘要: 最近要看一下erlang连接池,觉得ranch很不错。 github上面有人写了ranch的代码阅读,可以看一下,链接在这里。 1. ranch可以同时监听多个端口,每个端口的连接信息可以单独配置。 每个端口的监听信息通过ranch_server进程记录,然后获取信息可以从ets表读取。因为配置信息 阅读全文
posted @ 2016-02-20 10:54 格通 阅读(267) 评论(0) 推荐(0) 编辑
摘要: 今天使用http get 方法时,参量中有中文而导致出错。 例如http://abc.com/abc?arg=中文,在erlang使用http:request方法失败。 后来查了url的规范,url中要使用ascii字符,从而写了下面的方法: lists:append([io_lib:format( 阅读全文
posted @ 2016-02-19 19:08 格通 阅读(253) 评论(0) 推荐(0) 编辑
摘要: 最近项目内存占用过多,检查一下erlang的内存使用情况。 1. 通过etop可以很方便得出erlang内存使用的情况 spawn(fun() -> etop:start([{output, text}, {interval, 5}, {lines, 20}, {sort, memory}]) en 阅读全文
posted @ 2016-02-18 15:05 格通 阅读(947) 评论(0) 推荐(0) 编辑
摘要: git checkout . 参考:http://opentechschool.github.io/social-coding/extras/delete-restore.html 阅读全文
posted @ 2016-02-01 20:45 格通 阅读(255) 评论(0) 推荐(0) 编辑
摘要: 参考lager_transform未定义错误 阅读全文
posted @ 2016-02-01 19:57 格通 阅读(201) 评论(0) 推荐(0) 编辑
摘要: Visualizing Concurrency in Go 阅读全文
posted @ 2016-01-28 12:54 格通 阅读(148) 评论(0) 推荐(0) 编辑
摘要: http://blog.equanimity.nl/blog/2015/03/15/erlang-one-weird-trick-goodiebag/ http://erlang.org/pipermail/erlang-questions/2012-December/071223.html 备注一 阅读全文
posted @ 2016-01-27 21:11 格通 阅读(385) 评论(0) 推荐(0) 编辑
摘要: 设置时间:date -s "2016-02-26 23:58:0"恢复到正常时间:ntpdate pool.ntp.org在使用ntpdate过程中,遇到过问题: 7 Feb 00:25:30 ntpdate[5648]: Can't adjust the time of day: Invalid ... 阅读全文
posted @ 2016-01-27 11:42 格通 阅读(1129) 评论(0) 推荐(0) 编辑
摘要: Magnus Ahltorp的Mysql Driver里面介绍emysql的缺陷:1. 隔离不够好,2.不能伸缩mysql-otp使用1个进程1个mysql连接,隔离得很好。推荐使用。mysql-otp-poolboy使用poolboy + erlang-otp 来形成线程池,使用poolboy来避... 阅读全文
posted @ 2016-01-26 20:10 格通 阅读(856) 评论(0) 推荐(0) 编辑
摘要: utf8mb4支持emoji表情,在mysql中设置连接字符集为utf8mb4可以直接储存emoji表情。可以在客户端连接中设置:SET NAMES utf8mb4查看是否起效:SHOW VARIABLES LIKE 'char%';在mysql-otp可以在mysql:start_link/1函... 阅读全文
posted @ 2016-01-26 19:28 格通 阅读(657) 评论(0) 推荐(0) 编辑
摘要: Erlang doesn't detect net splits by itself. You could start looking atnet_kernel:set_net_ticktime/2 (try to increase this value if your node issufferi... 阅读全文
posted @ 2016-01-23 17:22 格通 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 今天部署一个阿里云服务器,所有配置项都改好了,就是连接不上本机。反复查找,防火墙端口和网卡接口都配置对了,selinux也关闭了,但就是连接不上阿里云内网的ip。由于连接是本机,把ip填写为127.0.0.1就可以了,猜测是阿里云内部网络的dns服务器不稳定。因为我们部署有几个服务器,我用setup... 阅读全文
posted @ 2016-01-23 15:08 格通 阅读(668) 评论(0) 推荐(0) 编辑
摘要: PHP 开发环境一键安装包, 有个叫lnmp。这个ltnmp看起来更新比较多,开发比较频繁,包括的组件更多。安装和使用教程:http://www.moqifei.com/ltnmp标记一下。 阅读全文
posted @ 2016-01-23 11:17 格通 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 今天发现一个问题,2个erlang节点,1个主动ping另外一个不通,然后等待另外一个ping过来,2个节点才连通。记录一下。首先,erlang节点的cookie是一致的。查了文档,cookie一致就可以连通的。其次,跟用户权限没关系,超级用户跟普通用户是一样的。后来google了一番,发现了几个相... 阅读全文
posted @ 2016-01-22 13:08 格通 阅读(882) 评论(0) 推荐(0) 编辑
摘要: 记录一下使用的具体命令,具体参考:Centos设置禁止密码登录而只使用密钥登录SSH方法 优先参考这个。ssh使用公钥授权不通过的问题解决Xshell配置ssh免密码登录-密钥公钥(Public key)与私钥(Private Key)登录#mkdir ~/.ssh#ssh-keygen -t rs... 阅读全文
posted @ 2016-01-22 12:53 格通 阅读(435) 评论(0) 推荐(0) 编辑
摘要: sed '/^echo/!s/text/subtext/g'如果是以echo开始行首的行就不进行替换。参考sed substitution conditional 阅读全文
posted @ 2016-01-21 09:54 格通 阅读(218) 评论(0) 推荐(0) 编辑
摘要: 静态ip参考Ubuntu通过PPTP协议使用VPN动态ip直接使用network-manager 阅读全文
posted @ 2016-01-19 21:23 格通 阅读(44) 评论(0) 推荐(0) 编辑
摘要: cd yourdirectoryperl -e 'for(){((stat)[9]<(unlink))}'参考Efficiently delete large directory containing thousands of files 阅读全文
posted @ 2016-01-19 20:49 格通 阅读(238) 评论(0) 推荐(0) 编辑
摘要: find . -size 0 -name "*.log" -exec rm {} \; 阅读全文
posted @ 2016-01-19 20:48 格通 阅读(139) 评论(0) 推荐(0) 编辑
摘要: find . -type d -maxdepth 1 | grep "./" | sed 's/\.\///g' | sed 's/-[0-9].*$//' | sort -u 阅读全文
posted @ 2016-01-19 17:33 格通 阅读(221) 评论(0) 推荐(0) 编辑
摘要: yum install `yum deplist emacs | grep provider | awk -F: '{print $2}' | awk '{print $1}' | xargs`yum install libX11-devel libjpeg-turbo-devel libpng-d... 阅读全文
posted @ 2016-01-19 17:32 格通 阅读(324) 评论(0) 推荐(0) 编辑
摘要: grep -vxFf b.txt a.txt > newa.txt更好的方法是comm -1 -3 b.txt a.txt > newa.txt来自Tool in unix to subtract text files? [duplicate] 阅读全文
posted @ 2016-01-19 16:40 格通 阅读(252) 评论(0) 推荐(0) 编辑
摘要: linux:svn propset svn:executable on *svn commit -m "add executable property" 阅读全文
posted @ 2016-01-19 16:23 格通 阅读(226) 评论(0) 推荐(0) 编辑
摘要: $emacs在emacs查看里面,输入:C-u 0 M-x byte-recompile-directory然后输入~/.emacs.d即可。 阅读全文
posted @ 2016-01-19 14:14 格通 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 在同一个生产环境中,多语言配合开发是常态,暂时发现几个不同方法。1. 共享数据库。数据库是瓶颈,如果有其中一个锁住了数据库,其他的所有的都会崩溃。2.使用thrift多语言RPC调用。3.使用rabbitmq等消息队列。 阅读全文
posted @ 2016-01-19 13:16 格通 阅读(283) 评论(0) 推荐(0) 编辑
摘要: $erl -name a@localhost -setcookie abc -remsh b@localhost1>fprof:trace([start, {file, "/home/getong/first.trace"}, verbose, {procs,all}]).2>fprof:trac... 阅读全文
posted @ 2016-01-19 13:12 格通 阅读(303) 评论(0) 推荐(0) 编辑
摘要: random模块使用相同的种子,在不同的进程中会出现相同的结果。rand的模块使用不同的种子,在不同的进程中不会出现相同的结果。2个模块都是erlang自带的。然后erlang在文档里面注明推荐使用rand替换random最近部署出了问题,就是因为项目有个文件名称也是rand.erl,源码删了,但编... 阅读全文
posted @ 2016-01-15 18:16 格通 阅读(199) 评论(0) 推荐(0) 编辑
摘要: mysqldump -u root -p -h --opt -d --single-transaction | sed 's/ AUTO_INCREMENT=[0-9]*\b//' > .sql使用 if not existssed -i 's/CREATE TABLE/CREATE TABLE... 阅读全文
posted @ 2016-01-15 13:03 格通 阅读(548) 评论(0) 推荐(0) 编辑
摘要: find . -name file -exec echo abc > {} \; fail应该改用:find . -name file -exec bash -c 'echo abc > {}' \;或者for i in `find . -name file`do echo abc > $i... 阅读全文
posted @ 2016-01-13 15:04 格通 阅读(435) 评论(0) 推荐(0) 编辑
摘要: git clone https://github.com/erlang/otpcd otpgit taggit checkout -b OTP-18.2.2 OTP-18.2.2./otp_build allexport LANG=en./configure --prefix=/usr/local/... 阅读全文
posted @ 2016-01-12 21:25 格通 阅读(378) 评论(0) 推荐(0) 编辑
摘要: 参考karl's answer1> L = lists:seq(1,10).[1,2,3,4,5,6,7,8,9,10]Associate a random number R with each element X in L by making a list of tuples {R, X}. So... 阅读全文
posted @ 2015-10-22 16:43 格通 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 标记一下,原文参看purcell的emacs配置中的自动补全功能开启修改init-auto-complete.el文件;;(setq-default ac-expand-on-auto-complete nil);;(setq-default ac-auto-start nil) 顺便提一下,最近... 阅读全文
posted @ 2015-10-07 19:03 格通 阅读(331) 评论(0) 推荐(0) 编辑
摘要: 通过dmesg发现vboxdrv启动报错: [ 18.844888] systemd[1]: [/lib/systemd/system/vboxdrv.service:5] Failed to add dependency on $syslog.service, ignoring: Invali... 阅读全文
posted @ 2015-10-07 18:24 格通 阅读(265) 评论(0) 推荐(0) 编辑
摘要: 1.对字符串进行hash大家可以看一下, SHA1 HashesGo by Example写道:The pattern for generating a hash is sha1.New(), sha1.Write(bytes), then sha1.Sum([]byte{}). 附上golang代... 阅读全文
posted @ 2014-06-16 16:37 格通 阅读(4115) 评论(0) 推荐(0) 编辑
摘要: 1.删除多余的自编译的内核每次Debian发布内核更新,总是有某些内核选项跟自己的硬件不配套,要自己编译内核。编译多了,多余的内核就占用了多余的硬盘空间。我就试过因为/boot分区满了,而导致编译内核失败。为了腾出有限的资源,删除多余的内核很有必要。看到了卸载自己编译的内核找到了可行的方法。主要的思... 阅读全文
posted @ 2014-06-10 09:50 格通 阅读(473) 评论(0) 推荐(0) 编辑