一些微小的说明

In order to unite my blogs, I decide that this blog will receive no updates from now on and I will move to a new place.

 

AOSC OS

电脑挂了后就直接装了 AOSC OS。和 Debian 完全是两种作风:Debian 要把包拆得细细的,还都很老,AOSC OS 的包粒度很粗,整个 LibreOffice 只有一个包!而且更新很快。

The AOSC way.

——Jeff Bai

第一关是安装。AOSC OS 是用 tarball 安装的,给我这种用惯了安装程序的家伙带来了一些困扰。不过我好歹有点 Linux 使用经验。找来了之前的 Gentoo LiveDVD,随手 mkfs.ext4 然后按着 GitHub 上的说明就成功安装了。其实也很简单。

第二关是网卡驱动。可喜 AOSC OS 的开源驱动直接支持我的网卡,不必花费时间折腾。

第三关是显卡驱动。nouveau 至今没启动起来,一直是 llvmpipe。

第四关是缺软件。自己打包呗。AOSC OS 有一套用 bash 脚本(没错这是真的)写的自动化工具,其中 autobuild3 就是为此而生的,可以通过很少量的一些配置打包出 deb 和 rpm,用起来十分惬意。比如这是 easytag 的包

剩下的就是一些零零碎碎的小问题,比如缺某些包依赖啦(发个 issue 呗)、Pepper Flash Plugin 装不上啦(买代理呗)……

神奇的电子产品

如果在几年前我玩 Arduino 的话,估计我不会这么惊讶,不过学了好多原理之后,就对这玩意里面的很多东西感到惊奇了……

电压怎么就神奇的反转了,波形怎么就神奇的变化了,传感器怎么就能输出信号了,这些信息怎么就被芯片截获了,之类的,越是玩下去,就越想知道这小小的黑盒子到底是怎么制造的……

请不要用验证码玩弄用户

我过去读过小虾的类似文章,很有意思,《无聊入门一下传说中的验证码识别技术》《浅谈某些网页验证码以及绕过验证》。谁想到今天遇到了更搞笑的:某网站光明正大地使用随机生成的文本。

我们来看看这是个什么网站。

一开始是有人来问怎么识别验证码的,但是,随手一看就能发现猫腻……

然后再看看代码:

嗯……这边没有检查。那是不是连带验证码也发送了呢?

……等等!!为什么只是在本地 validate 一下啊?!(其实还有 validate 和 createCheck 的源码,太懒就不发了)

(再吐槽一句,check code 是什么玩意儿?validation code 很不服气啊!)

也就是说,这个验证码只是在前端生成+验证的,つまり,也就只能糊弄一下用户!

验证码一开始是用来限制机器人的,用以辨别用户是不是人,随着 OCR 技术的不断精进,验证码也愈发复杂,今天见了这个验证码,倒是有点返璞归真的感觉……个屁,只能给用户造成麻烦,却不能阻挡机器人,要你何用?

当然,凡事我们要辩证地看,绞尽脑汁后我们也能找出那么一两点好处的(转自小虾文章):

  1. 加这个验证码是让查的人不那么急,流量不那么拥挤
  2. 加这个验证码的目的可能是让用户有机会停下来确认输入的数据是否正确

(但是,人都输入验证码了,谁还会去回头检查输入的数据?)

这篇文章权且一乐,大家轻松一下就行了。当然,也别去深究那是什么网页了……

扔掉 Emacs,投奔 JED

我原来的 Emacs 文件现在已经扔在了 115 网盘。点这里下载。

JED 是一个更小更快的 Emacs 实现。它用 S-Lang 作为扩展语言而不是 Emacs Lisp。S-Lang 是一个类 C 的脚本语言,作为扩展语言真是太合适不过了。

在 Fedora 上可以用 sudo yum install jed 来安装 JED(不过貌似没有用于 X 的 XJED)。安装后在终端上输入 jed 就能启动了。

默认安装下,jed的速度相当快,完全比过了 vim(另一个强大的编辑器)。

如果你要扩展你的 jed,可以去 JED Modes Repository,这里有很多让你的 JED 更加强大的 Mode。

要使用这些 Mode,在你的 ~/.jedrc 中写上 require ("mode名字"); 即可。

另外特别附上我现在用的 .jedrc。

%% 
%% dot jedrc of Mike Manilone
%% 



% 快速切换buffer
require("numbuf");

% 行号
LINENUMBERS=2;
public define global_mode_hook (hook_name)
{
    toggle_line_number_mode ();
}

% C缩进格式
c_set_style("bsd");
TAB_DEFAULT=4;
USE_TABS=0;

% 配色
set_color_scheme ("black3");

% 无~备份
No_Backups = 1;

熟悉C语言的你,是不是感到特别亲切呢?

这里唯一需要你动手的是在这里下载 numbuf 并放到 /usr/share/jed/lib/ 下,然后就可以用了。很可惜我经常用的tabbar和Alt + 左右键切换buffer没有,不过 S-Lang 很简单,不知道哪个大牛给写一个~

更新:

jed没有标签窗口,所以tabbar不可能实现,不过有一种变相实现的方法,Buffers->Change Buffer底下不就是Buffer列表吗?我们可以绑定它啊!所以:

setkey("menu_select_menu(\"Global.&Buffers.&Change Buffer\")", "\ez"); % alt+z显示buffer切换菜单

感谢 John E. Davis 提供的技巧(原文见此,很有价值)。

我们还能绑定ctrl+alt+n到下一个buffer(可惜的是没有向前)

setkey ("next_buffer", "\e^N"); 

Linux下ISO处理

其实本贴是给各种小白准备的。

还记得Windows下DT的ISO支持吗?还在DT地找UltraISO for Linux版吗?你out了!(准确说你太超前了)在多少年前,UNIX就有了牛B的dd和mount(包括umount),它们就可以操作ISO了(这里不包括刻录,刻录请移步cdrecord和dvdrecord)

从光盘搞到映像文件

还在从光盘获取映像文件上不知所措?用dd吧!比如你用dvd,就直接这样

dd if=/dev/dvd of=[输出文件名]

cd就把dvd替换成cd,是不是很简单?

挂载映像文件

这也太简单了,在mnt下创建一个目录,然后直接:

sudo mount [映像文件名] [刚才创建的空目录地址]

that's all.

如果只读,会有提示。

卸载

umount 刚才创建的空目录地址

其他

除第一个操作外,其他全部需要root权限。

这些东西其实都有GUI版,但是命令行还是快一点。(除非GUI智能了)

无根的根:无名师的Unix心传(Rootless Root: The Unix Koans of Master Foo)补遗

无名师与MCSE能者(Master Foo And the MCSE)

一通熟Windows之能者见无名师,曰:“闻师深修Unix之道,吾以密巧相述,相益,可乎?”

无名师曰:“求智,善矣;然Unix之道并无甚密巧。”

能者惑:“人曰师乃当世Unix大道之贤者,通晓其中之变法,如吾之于Windows;吾乃MCSE,有世所罕之证书,吾铭记各注册表项功能于心,更可细述任一Windows API,乃至微软所未曾详述者。师,所以为师,为智,皆揭而知他人之不知也。”

无名师曰:“怠矣,本无秘,何以揭?”

能者嗔:“若无密巧,何以修乃成师之业?”

无名师曰:“求智者,以他人之不知为智,犹如求光明者,拥烛笼火,以为珍贵,乃终被灼也。”

听此,能者顿觉灵光。

Master Foo and the MCSE

Once, a famous Windows system administrator came to Master Foo and asked him for instruction: “I have heard that you are a powerful Unix wizard. Let us trade secrets, that we may both gain thereby.”

Master Foo said: “It is good that you seek wisdom. But in the Way of Unix, there are no secrets.”

The administrator looked puzzled at this. “But it is said that you are a great Unix guru who knows all the innermost mysteries. As do I in Windows; I am an MCSE, and I have many other certifications of knowledge not common in the world. I know even the most obscure registry entries by heart. I can tell you everything about the Windows API, yes, even secrets those of Redmond have half-forgotten. What is the arcane lore that gives you your power?”

Master Foo said: “I have none. Nothing is hidden, nothing is revealed.”

Growing angry, the administrator said “Very well, if you hold no secrets, then tell me: what do I have to know to become as powerful in the Unix way as you?”

Master Foo said: “A man who mistakes secrets for knowledge is like a man who, seeking light, hugs a candle so closely that he smothers it and burns his hand.”

Upon hearing this, the administrator was enlightened.

转载自:http://blog.sinzy.net/jinjian/entry/22169

 

 

下面的都是自己翻译的,有误之处请指出:

无名师与命令行工具(Master Foo and the Shell Tools)

一Unix初学者谓无名师曰:“吾甚惑矣。此非Unix大道邪?程序皆应完成己职?”

师颔首。

此初学者又曰:“轮不可更之亦Unix之大道邪?”

师再颔首。

“然,于文本之处理有相同之物:sed、awk与Perl何也?于Unix大道孰可制成至佳?”

师问初学者曰:“若汝有一文本,何物汝用之生一副本替自尔之选之文本?”

初学者蹙眉曰:“Perl之正则对此甚简单,吾不知awk,吾将书一sed脚本。吾深通sed,斯时吾之愿矣。然若此职仅一次,而非重复,一文本之编辑器足矣。”

师颔首答曰:“汝饿而食,渴而饮,困而眠,与之同也。”

闻此,初学者顿觉灵光。

A Unix novice came to Master Foo and said: “I am confused. Is it not the Unix way that every program should concentrate on one thing and do it well?

Master Foo nodded.

The novice continued: “Isn't it also the Unix way that the wheel should not be reinvented?

Master Foo nodded again.

Why, then, are there several tools with similar capabilities in text processing: sed, awk and Perl? With which one can I best practice the Unix way?

Master Foo asked the novice: “If you have a text file, what tool would you use to produce a copy with a few words in it replaced by strings of your choosing?

The novice frowned and said: “Perl's regexps would be excessive for so simple a task. I do not know awk, and I have been writing sed scripts in the last few weeks. As I have some experience with sed, at the moment I would prefer it. But if the job only needed to be done once rather than repeatedly, a text editor would suffice.

Master Foo nodded and replied: “When you are hungry, eat; when you are thirsty, drink; when you are tired, sleep.

Upon hearing this, the novice was enlightened.

无名师与老手(Master Foo and the Old Hand)

一强Unix程序员,闻无名师之智,访而求教。至师前三鞠躬,曰:

“师,吾忐忑至深。吾幼,人皆追随Unix大道,其软件若ed,mailx之简明、无碍。今,其用vim与mutt。明,吾惧其欲用KMail与Evolution,Unix欲为Windows矣。其臃肿且图形之界面之多。”

师曰:“然汝欲制一海报,将用何物?”

程序员答曰:“吾未尝制之……然吾之于Unix大道之无用图形界面,而用LaTeX或图制之。”

师曰:“此二人谁人能及对岸:其一思一舟,其二行至一桥?”

闻此,程序员顿觉灵光。

An experienced Unix programmer, hearing of Master Foo's wisdom, came to him for guidance. Approaching the Master, he bowed three times and said:

Master Foo, I am gravely troubled. In my youth, those who followed the Great Way of Unix used software that was simple and unaffected, like ed and mailx. Today, they use vim and mutt. Tomorrow I fear they will use KMail and Evolution, and Unix will have become like Windows — bloated and covered over with GUIs.

Master Foo said: “But what software do you use when you want to draw a poster?

The programmer replied: “I...have never done that. But I am sure that I could use LaTeX or pic to accomplish it without GUIs, in the proper Unix way.

Master Foo then said: “Which one will reach the other side of the river: The one who dreams of a raft, or the one that hitchhikes to the next bridge?

Upon hearing this, the programmer was enlightened.

无名师与傻瓜新手(Master Foo and the Nervous Novice)

(虚位以待)

There was a novice who learned much at the Master's feet, but felt something to be missing. After meditating on his doubts for some time, he found the courage to approach Master Foo about his problem.

Master Foo,” he asked “why do Unix users not employ antivirus programs? And defragmentors? And malware cleaners?

Master Foo smiled, and said “When your house is well constructed, there is no need to add pillars to keep the roof in place.

The novice replied “Would it not be better to use these things anyway, just to be certain?

Master Foo reached for a nearby ball of string, and began wrapping it around the novice's feet.

What are you doing?” the novice asked in surprise.

Master Foo replied simply: “Tying your shoes.

Upon hearing this, the novice was enlightened.

无名师论返回Windows(Master Foo Discourses on Returning to Windows)

虚位以待

A student said: “We have learned that Unix is not just an operating system, but also a style of approaching problems.

Master Foo nodded in agreement.

The student continued: “Then, the Great Way of Unix can be applied on other operating systems?

Master Foo sat silent for a moment, then said: “In every operating system there is a path to the Great Way, if only we can find it.

The student continued: “What, then, of Windows? It is preinstalled on most computers, and though its tools are mostly far inferior, they are easy to use for beginners. Surely, Windows users could benefit from the Unix philosophy.

Master Foo nodded again.

The student said: “How, then, are those enlightened in the Unix Way to return to the Windows world?

Master Foo said: “To return to Windows, you have but to boot it up.

The student said, growing agitated: “Master Foo, if it is so easy, why are there so many monolithic and broken software packages for Windows? Elegant software should also be possible with a GUI and fancy colors, but there is little evidence that this occurs. What becomes of an enlighted one who returns to Windows?

Master Foo: “A broken mirror never reflects again; fallen flowers never go back to the old branches.

Upon hearing this, all present were enlightened.

 

VBS简单的文件下载器

学校只有ie,不准下载文件,可以用这个下载文件

这是网上查的代码,自己加了InputBox,直接双击即可打开

Dim sURL, sPath

sURL = InputBox("下载文件的网址是?")
sPath = InputBox("存储的文件名是?")
Set xPost = createObject("Microsoft.XMLHTTP") 
xPost.Open "GET",sURL,0
xPost.Send() 
Set sGet = createObject("ADODB.Stream") 
sGet.Mode = 3 
sGet.Type = 1 
sGet.Open() 
sGet.Write(xPost.responseBody) 
sGet.SaveToFile sPath,2

如果你是一个确确实实的懒人,或者你IQ有问题,不会创建vbs文件,可以试试直接下载该文件,直接双击即可。(当然如果不能下载的话例外)