奇了怪了
在这个国度,政府以道德的名义加上行政力量来处罚能搜索出淫秽内容的搜索引擎,却全然没有去反思人们为何会搜索这些内容,更没有去积极的去处罚淫秽内容的发布者。这和藏污纳垢又有何区别!四千年前便有了“大禹治水”,至今却仍然不知疏导。这是为什么?集权暴力?集体健忘?千里之堤也有溃于蚁穴的那天。
标签: life
Let only that little be left of me whereby I may name thee my all.
在这个国度,政府以道德的名义加上行政力量来处罚能搜索出淫秽内容的搜索引擎,却全然没有去反思人们为何会搜索这些内容,更没有去积极的去处罚淫秽内容的发布者。这和藏污纳垢又有何区别!四千年前便有了“大禹治水”,至今却仍然不知疏导。这是为什么?集权暴力?集体健忘?千里之堤也有溃于蚁穴的那天。
标签: life
稍微测试了一下,用Python写一个IPv6的XML-RPC客户端比较简单:
import xmlrpclib
server = xmlrpclib.ServerProxy('http://[::1]:4444/usermgmt')
print server.list_users({'namespace' : 0})
require 'xmlrpc/client'
server = XMLRPC::Client.new2('http://[::1]:4444/usermgmt')
p server.call('list_users', {'namespace'=>0})
getaddrinfo: Name or service not known (SocketError)
server = XMLRPC::Client.new('::1', # host
'/usermgmt', # path
8010, # port
nil, # proxy_host
nil, # proxy_port
nil, # user
nil, # password
false, # use_ssl
nil) # timeout (default: 30)
标签: ruby
这个礼拜还是比较充实的,至少很久没有这么充实了。终于弄出一个补丁,使得我们的服务器可以支持IPv6。基本的PoC已经在上周完成。因为没法等OpenSSL 1.0.0的正式release,于是只能自己改代码。手工创建 socket然后把accept()之后的connfd包装在一个BIO里面,所谓“曲线救国”了。本周只是把那些已经验证过的逻辑加到库中。本以为没啥问题的小事,却折腾了整整五天。
sbio = BIO_new_ssl(server->ctx, 0);
bbio = BIO_new(BIO_f_buffer());
sbio = BIO_push(bbio, sbio);
void BIO_copy_next_retry(BIO *b)
{
BIO_set_flags(b,BIO_get_retry_flags(b->next_bio));
b->retry_reason=b->next_bio->retry_reason;
}
sbio = BIO_push(sbio, BIO_new(BIO_f_null()));
bbio -> sbio -> null
标签: openssl
睁开眼睛,抬头看表,10:48pm。“哎呀,LP,明天的午餐还没做咧!”
标签: life
最近的任务是让我们的XML-RPC Server能够在IPv6网络下远程访问。我们的底层数据是用OpenSSL的BIO来处理的,这意味着如果BIO_new_accept()之类直接支持了IPv6,那我的工作就容易许多。可惜的是,目前还不支持。综合搜索的结果来看,我只能手工创建socket,绑定一个IPv6地址,然后将accept之后的socket绑定到某个BIO。试了一下,确实可行。
OK, to be absolutely sincere. It's not about what Microsoft [or RedHat] supports for the moment, but about exercising above mentioned discipline. It's not about looking for excuses, but exploring maximum possible extent of portability. Is it possible to write code which adapts itself to run-time environment? Regardless whether run-time is supported by vendor or not? How complicated is it? Forget that you're RedHat employee, become programmer instead:-) But this is getting off-topic. DSO_global_lookup was not the point I wanted to emphasize! DSO_global_lookup is mentioned only because you'll have to cope with it in HEAD branch. The main point is that changes of this haracter should be *conditional* for backward compatibility and you have to play by this rules.
标签: openssl
-- compile with: ghc --make cat.hs
import System.IO
import System.IO.Error
import System.Environment
cat :: String -> IO ()
cat fn = do
contents <- readFile fn
putStr contents
handler :: IOError -> IO ()
handler e
| isDoesNotExistError e =
case ioeGetFileName e of
Just path -> putStrLn $ path ++ ": file not found"
Nothing -> putStrLn "Oops! File unknown."
| otherwise = ioError e
main = do args <- getArgs
if null args
then interact id
else mapM_ (\fn -> cat fn `catch` handler) args
标签: haskell
每学一门语言首先想做的是用它写一个类UNIX下cat命令的东西,简单但至少涉及命令行处理和文件I/O。
(define (cat . arg)
(let ((port (if (null? arg)
(current-input-port)
(car arg))))
(let loop ((c (read-char port)))
(if (not (eof-object? c))
(begin
(display c)
(loop (read-char port)))))))
(define (main args)
(if (null? (cdr args))
(cat)
(for-each (lambda (port) (cat port) (close-input-port port))
(map open-input-file (cdr args)))))
import System.Environment
cat :: String -> IO ()
cat fn = do
contents <- readFile fn
putStr contents
main = do args <- getArgs
if null args then interact id else mapM_ cat args
import qualified Data.ByteString.Lazy as B
cat :: String -> IO ()
cat fn = do
bs <- B.readFile fn
B.putStr bs
突然发现今天还没去reddit.com巡逻,于是直奔而去。看见一段有意思的comments,摘抄如下:
A: Just a side note: is there anyone in the CS field with more badass name than Guy Steele?
B: I assume some CS guy somewhere has legally changed his name to Max Power.
标签: life
我现在的状态大概可以用“带薪学习”来形容 -- 但老实说,这种状态下的学习效率多数都很低下。
标签: haskell
这几天网络常常莫名奇妙的会断掉,考虑到LP仍然能正常上网,这应该不是AP的问题。有点怀疑自己本本的无线网卡是不是大限将至。重载ipw2200后再重启网络,似乎一切又恢复正常。只是过段时间后,复又如是,莫名其妙。
iwconfig eth1 essid "TP-LINK" key s:******
iwconfig eth1 ap 00:1D:0F:XX:YY:ZZ key s:******
标签: linux