迎接 Gnome 3
2014年9月03日 00:05
Happy coding
最开始的时候有点不习惯,加之集显的性能有限,总是感觉很不爽。今天加了一块独显 (HD 5750), 又费了些时间折腾驱动和配置,终于可以流畅的跑起来了,可惜很多很酷的东西没想到办法怎么抓图。
家里的机器装上了 gnome3 , gnome3 里面,只要将鼠标移到左上角, 当前桌面上所有的活动就会以缩略图的形式平铺在桌面上, 然后鼠标再轻轻一点就可以切换到所需的程序上去。很方便。
而公司里面的工作机的配置不高,且不能通过 git 获取代码,所以没有升到 gnome3 , 但在工作中使用鼠标的时候,总是习惯使然的把鼠标移动到左上角想要切换程序, 然后总是败兴而归。
刚刚折腾了一下,居然通过五行代码就可以通过鼠标的移动来调用 windowlist , 虽然不能像 Gnome3 那样看到缩略图,但也算聊胜于无吧!
代码如下:
# Show WindowList if place mouse at top left corner.
EdgeCommand Left PopupWindowList $[pointer.x] $[pointer.y]
EdgeCommand Top PopupWindowList $[pointer.x] $[pointer.y]
DestroyFunc PopupWindowList
AddToFunc PopupWindowList
+ I PipeRead `[ $[pointer.x] -lt 30 ] && [ $[pointer.y] -lt 30 ] && echo "Windowlist (CurrentPage) NoDeskSort, SelectOnRelease, Meta_L,CurrentAtEnd, IconifiedAtEnd"`
作者: 阮一峰
日期: 2011年5月 2日
如何为代码选择开源许可证,这是一个问题。
This first short wil learn us how to generate a key without a passphrase, and use it in a console.
When you want to use ssh with keys, the first thing that you will need is a key. If you want to know more about how this mechanism works you can have a look in chapter 3, SSH essentials. Hence there are 2 versions, we will show examples for the both of them.
To create the most simple key, with the default encryption, open up a console, and enter the following command :
[dave@caprice dave]$ ssh-keygen
Wil output the following :
Generating public/private rsa1 key pair. Enter file in which to save the key (/home/dave/.ssh/identity): /home/dave/.ssh/identity Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/dave/.ssh/identity. Your public key has been saved in /home/dave/.ssh/identity.pub. The key fingerprint is: 22:bc:0b:fe:f5:06:1d:c0:05:ea:59:09:e3:07:8a:8c dave@caprice
When asked for a "passphrase", we won't enter one. Just press enter twice.
The ssh-keygen program will now generate both your public and your private key. For the sake of this first simple tutorial I will call these files by their default names "identity" and the public key "identity.pub".
Your keys are stored in the .ssh/ directory in your home directory, but you can store them where ever you'd like. Good practice is to backup your keys on a floppy. If you do so, guard this floppy with your life!
* Note: specifying a key type may be mandatory on your system. In that case, skip to the version 2 key geneation process.
Lets have a look at your keys.
cd ~.ssh; ls -l -rw------- 1 dave dave 526 Nov 2 01:33 identity -rw-r--r-- 1 dave dave 330 Nov 2 01:33 identity.pub
The file identity
contains your private key. YOU SHOULD GUARD THIS KEY WITH YOUR LIFE! This key is used to gain access on systems which have your private key listed in their authorized keys file. I cannot stress this enough, dont have your keys drifting around. Also, make sure your private key always is chmod 600, so other users on the system won't have access to it.
The file identity.pub
contains your public key, which can be added to other system's authorized keys files. We will get to adding keys later.
Creating a version 2 keypair is much like creating a version 1 keypair. Except for the fact that the SSH protocol version 2 uses different encryption algorithms for its encryption. In this case we can even choos it ourselves! Huray! To find out which versions are available on your system I'd advise you to have a look in the ssh-keygen manpage.
In our example we wil create a keypair using dsa encryption. This can be done by passing the key encryption method type to ssh-keygen. This is done in the following way :
[dave@caprice dave]$ ssh-keygen -t dsa
Which will output the following :
[dave@caprice dave]$ ssh-keygen -t dsa Generating public/private dsa key pair. Enter file in which to save the key (/home/dave/.ssh/id_dsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/dave/.ssh/id_dsa. Your public key has been saved in /home/dave/.ssh/id_dsa.pub. The key fingerprint is: 7b:ab:75:32:9e:b6:6c:4b:29:dc:2a:2b:8c:2f:4e:37 dave@caprice
Again, we will retain the default locations, and we will not use a passphrase either.
Your keys are stored in the .ssh/ directory in your home directory.
Lets have a look at your keys.
cd ~.ssh; ls -l -rw------- 1 dave dave 526 Nov 3 01:21 id_dsa -rw-r--r-- 1 dave dave 330 Nov 3 01:21 id_dsa.pub
The file id_dsa
contains your version 2 private key.
The file id_dsa.pub
contains your version 2 public key, which can be added to other system's authorized keys file.
Again, I have listed a full ls -l with permissions, make sure you have the permissions set up correctly, otherwise other users may be able to snatch it from you. It is also a good idea to give your keys a non-standard name, since it makes guessing the name of your keypair files more easy.
To be able to log in to remote systems using your pair of keys, you will first have to add your public key on the remote server to the authorized_keys (for version 1) file, and the authorized_keys2 (for version2) file in the .ssh/ directory in your home directory on the remote machine.
In our example we will assume you don't have any keys in the authorized_keys files on the remote server. (Hint: If you do not have a remote shell, you can always use your own useraccount on your local machine as a remote shell (ssh localhost))
First we will upload the public keys to the remote server :
[dave@capricedave]$ cd .ssh/ [dave@caprice .ssh]$ scp identity.pub dave@192.168.1.3:./identity.pub identity.pub 100% |*****************************************************| 526 00:00 [dave@caprice .ssh]$ scp id_dsa.pub dave@192.168.1.3:./id_dsa.pub identity.pub 100% |*****************************************************| 614 00:00
This will place your keys in your home directory on the remote server. After that we will login on the remote server using ssh or telnet the conventional way... with a password.
When you are logged in you should create a .ssh directory, and inside the .ssh/ directory create an authorized_keys and an authorized_keys2 file and add the keys to the files. Make sure the files are not readable for other users/groups. chmod 600 authorized_keys* does the trick.
Adding the public key for version 1 works like this:
[dave@caprice dave]$ ssh 192.168.1.3 -v [I edited out the verbose output, and entered the password] [Remember kids, always use -v so dont try this at home :) ] [dave@julia dave]$ mkdir .ssh [dave@julia dave]$ chmod 700 .ssh [dave@julia dave]$ cd .ssh [dave@julia .ssh]$ touch authorized_keys [dave@julia .ssh]$ chmod 600 authorized_keys [dave@julia .ssh]$ cat ../identity.pub >> authorized_keys [dave@julia .ssh]$ rm ../identity.pub
Placing the key for version 2 works about the same :
[dave@julia dave]$ cd .ssh [dave@julia .ssh]$ touch authorized_keys2 [dave@julia .ssh]$ chmod 600 authorized_keys2 [dave@julia .ssh]$ cat ../id_dsa.pub >> authorized_keys2 [dave@julia .ssh]$ rm ../id_dsa.pub
If you take a little peek inside your public key files, you will find it to be a bunch of crypto, separated over a couple of rules. The public key is *1 line*. It is worth to note that the entire public key file should be one line in the authorized_keys files. So using >> is preferred over copying and pasting it from one document to another. This could put line breaks in your key which makes it useless.
Either way, your keys are in place, you are ready to go to the final step and log in using your keys.
To log in using your key use the ssh command. We will add -1 to make sure we are using SSH Protocol version 1.
ssh -1 -v dave@192.168.1.3
This logs you into a system using your version 1 key.
Try it again, now for version 2
ssh -2 -v dave@192.168.1.3
Have a look in the output of both ssh logins and you will be able to see some differences between version 1 and 2.
本文是从 41 Things I've Learned By 40 这篇文章翻译而来。
6月8日标志着我进入40岁。下面的是我这一路走来学到的41条建议:
41. 不要太在意别人如何看你。
40. 是人就有自尊。小心行事,不要伤害他们的自尊心。
39. 没有什么能比实干能给你更多的收获。
38. 不要嚼舌根。你所说出去的最终会以某种方式落回到你自己身上。
37. 和你了解和喜欢的人做生意。
36. 嫉妒和鄙视别人的行为不该出现在你的生活里。
35. 说“请”和“谢谢”。这会让你与众不同。
34. 需要帮助时要去请求帮助。
33. 把目标写下来是你实现梦想的重要一步。
32. 过度使用信用卡会让你未来的经济情况陷入困境。
31. 贤内助的份量重比黄金,更甚。
30. 真正的朋友会为任何能让你高兴的小事而兴奋。
29. 真正的朋友很少,要去珍惜。
28. 不存在铁饭碗。要准备一个“B计划”。
27. 善于发现别人的优点。不要老盯着别人的缺点。
26. 你开的车、你穿的衣服不代表你。不要用车和衣服或邮政编码来判断人。
25. 你是一个“品牌”。你的所作所为会影响这个牌子名声。
24. 幸运不是偶然的。
23. 年轻时就开始存钱。把你收入的10%存入养老金账户。
22. 花时间去思考你的未来。清楚什么才是成功。
21. 对孩子的爱永远不会太多!
20. 尊敬每个人。你永远不知道哪天命运会让这些轮回到你的身上。
19. 如果你不懂酒文化,就不要装懂。
18. 对待竞争者要友好。
17. 无论你的政治立场如何 —— 一生中要参加一次总统就职典礼。整个典礼都非常的酷。
16. 寻找一个导师。
15. 做一名导师。
14. 年纪越大越难保持身体的健康。但不管怎样也要保持住。
13. 并不是聪明才能成功。坚持比智慧更重要。
12. 拥有一个强有力的社交联系网是你职业生涯最强有力的保障。
11. 多读书,杂志,上网看博客和新闻。知识就是力量。
10. 写书很难。推广更难。
9. 开发你的公开演说技能。参加一个宴会主持人团体,参与锻炼两年。
8. 正直无价。
7. 拥有能够鞭策你、使你进步的朋友。
6. 如果你知道有人写了一本书,去读它。读他的书是对一个作者最大的敬意。
5. 助人最终受益的会是你自己。
4. 在你需要之前先找到一个好律师,会计,银行家。
3. 学会做饭。
2. 机会是存在的。你只需要去找到它们。
我学到的最后一件事情:
#1 – 那些真正有成就的人(金融上的,感情上的和精神上的)永远不会批评你的梦想和志向。相反,他们会想办法分享他们的经验,帮助你提高到一个新的水平。成功的人不会妒忌,他们乐见其他人有所成就。
这些建议是免费的 … 但请记住,你得到它们是因为你付出了。
祝一天好心情。
转自: http://www.aqee.net/2011/05/06/41-things-ive-learned-by-40/
作者: 阮一峰
日期: 2011年5月 9日
有人在Quora问:
"最令你吃惊的事实是什么?"
他得到了56个回答。其中最震撼我的,是下面的回答:
"人生只有900个月。"
我从没意识到,人生可以短暂到如此精确。回想刚刚过去的四月份,不过就是一眨眼的时间,但是人生的900分之一就已经消失了,真是恐怖啊。
事实上,你可以画一个30x30的表格,一张A4纸就够了。每过一个月,就在一个格子里打钩。你全部的人生就在这张纸上。你会因此有一个清晰的概念:你的人生是怎样被浪费掉的。
===============================
下面转载美国摄影师Tom Hussey的作品《A Mirrored Memory》(镜中回忆)。
========================================
P.S.
下面的事实也很让人吃惊。
1. 剑龙(Stegosaurus)与霸王龙(Tyrannosaurus)相隔的年代,比霸王龙(Tyrannosaurus)与人类相隔的年代还要久远。
2. 一付52张的扑克牌,共有8x1067种洗牌顺序。如果每秒洗牌一次,从地球诞生至今还没洗完。
3. 指挥Apollo 11登月的计算机,运行频率为1.024 MHz,不及今天的可编程计算器的六分之一。
4. 身上三种颜色的猫一定是母的。
5. 如果一个班有50个人,其中有两个人生日相同的概率是97%。
(完)