Quantcast
Channel: 看得透又看得远者prevail.ppt.cc/flUmLx ppt.cc/fqtgqx ppt.cc/fZsXUx ppt.cc/fhWnZx ppt.cc/fnrkVx ppt.cc/f2CBVx
Viewing all 20452 articles
Browse latest View live

awesome-lua

$
0
0


A curated list of awesome Lua frameworks, libraries and software.

from https://github.com/uhub/awesome-lua

这里有很多编程语言的awesome list

$
0
0
https://github.com/uhub/awesome-javascript
https://github.com/uhub/awesome-java
https://github.com/uhub/awesome-haskell
https://github.com/uhub/awesome-go
https://github.com/uhub/awesome-erlang
https://github.com/uhub/awesome-css
https://github.com/uhub/awesome-coffeescript
https://github.com/uhub/awesome-c
https://github.com/uhub/awesome-cpp
https://github.com/uhub/awesome-actionscript
https://github.com/uhub/awesome-actionscript-sorted
https://github.com/uhub/awesome-swift
https://github.com/uhub/awesome-scala
https://github.com/uhub/awesome-ruby
https://github.com/uhub/awesome-python
https://github.com/uhub/awesome-perl
https://github.com/uhub/awesome-php

https://github.com/uhub/awesome-r
https://github.com/uhub/awesome-objective-c
https://github.com/uhub/awesome-c-sharp
https://github.com/uhub/awesome-coq

from https://github.com/uhub

用cnpmjs.org搭建私有的npm registry

$
0
0
Private npm registry and web for Enterprise 

NPM version build status Test coverage David deps Known Vulnerabilities npm download
logo

What is this?

Private npm registry and web for Enterprise, base on koa, MySQL and Simple Store Service.
Our goal is to provide a low cost maintenance and easy to use solution for private npm.

What can you do with cnpmjs.org

  • Build a private npm for your own enterprise. (alibaba is using cnpmjs.org now)
  • Build a mirror NPM. (we use it to build a mirror in China: cnpmjs.org)
  • Build a completely independent NPM registry to store whatever you like.

Features

  • Support "scoped" packagesnpm/npm#5239
  • Support CORS
  • Simple to deploy: only need mysql and a simple store system. You can get the source code through npm or git.
  • Low cost and easy maintenancepackage.json info store in MySQL, MariaDB, SQLite or PostgreSQL databases, tarball(tgz file) store in CDN or other store systems.
  • Automatic synchronization: automatic synchronization from any registry specified, support two sync modes:
    • Sync all modules from a specified registry, like npm registry.
    • Only sync the modules that exists in your own registry.
  • Manual synchronization: automatic synchronization may has little delay, but you can syn immediately by manually.
  • Customized client: we provide a client cnpm to extend npm with more features(sync command, gzip support). And it easy to wrap for your own registry which build with cnpmjs.org.
  • Compatible with NPM client: you can use the origin NPM client with cnpmjs.org, only need to change the registry in config. Even include manual synchronization (through install command).
  • Version badge: base on shields.io cnpm-badge
  • Support http_proxy: if you're behind firewall, need to request through http proxy
PROTIP Be sure to read Migrating from 1.x to 2.x as well as New features in 2.x.

Getting Start

Develop on your local machine

Dependencies

  • node >= 4.3.1
  • Databases: only required one type
    • sqlite3 >= 3.0.2, we use sqlite3 by default
    • MySQL >= 0.5.0, include mysqld and mysql cli. I test on mysql@5.6.16.
    • MariaDB
    • PostgreSQL

Clone codes and run test

# clone from git
$ git clone https://github.com/cnpm/cnpmjs.org.git

# install dependencies
$ make install

# test
$ make test

# coverage
$ make test-cov

# update dependencies
$ make autod

# start server with development mode
$ make dev

Dockerized cnpmjs.org Installation Guide

Cnpmjs.org shipped with a simple but pragmatic Docker Compose configuration.With the configuration, you can set up a MySQL backed cnpmjs.org instance by executing just one command on Docker installed environment.

Preparation

Dockerized cnpmjs.org control command

Make sure your current working directory is the root of this GitHub repository.
Run dockerized cnpmjs.org
$docker-compose up
This command will build a Docker image using the current code of repository. Then set up a dockerized MySQL instance with data initialized. After Docker container running, you can access your cnpmjs.org web portal at http://127.0.0.1:7002 and npm register at http://127.0.0.1:7001.

Run cnpmjs.org in the backend

$docker-compose up -d

Rebuild cnpmjs.org Docker image

$docker-compose build

Remove current dockerized cnpmjs.org instance

The current configuration set 2 named Docker Volume for your persistent data. If you haven't change the repository directory name, them will be "cnpmjsorg_cnpm-files-volume"& "cnpmjsorg_cnpm-db-volume".
Be Careful, the following commands will remove them.
$docker-compose rm 
$docker volume rm cnpmjsorg_cnpm-files-volume
$docker volume rm cnpmjsorg_cnpm-db-volume
You can get more information about your data volumes using the below commands:
$docker volume ls  // list all of your Docker volume
$docker volume inspect cnpmjsorg_cnpm-files-volume
$docker volume inspect cnpmjsorg_cnpm-db-volume

How to contribute

  • Clone the project
  • Checkout a new branch
  • Add new features or fix bugs in the new branch
  • Make a pull request and we will review it ASAP
Tips: make sure your code is following the node-style-guide.

Sponsors

  • 阿里云 (2016.2 - now)
  • UCloud云计算 (2015.3 - 2016.3)
from https://github.com/cnpm/cnpmjs.org
--------

Usage

use our npm client cnpm(More suitable with cnpmjs.org and gzip support), you can get our client through npm:
$ npm install -g cnpm --registry=https://registry.npm.taobao.org
Or you can alias NPM to use it:
alias cnpm="npm --registry=https://registry.npm.taobao.org \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=https://npm.taobao.org/mirrors/node \
--userconfig=$HOME/.cnpmrc"


#Or alias it in .bashrc or .zshrc
$ echo
'\n#alias for cnpm\nalias cnpm="npm --registry=https://registry.npm.taobao.org \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=https://npm.taobao.org/mirrors/node \
--userconfig=$HOME/.cnpmrc"'
>>~/.zshrc && source ~/.zshrc

install

Install package from r.cnpmjs.org. When installing a package or version does not exist, it will try to install from the official registry(registry.npmjs.org), and sync this package to cnpm in the backend.
$ cnpm install [name]

sync

Only cnpm cli has this command. Meaning sync package from source npm.
$ cnpm sync connect
sync package on web: sync/connect
$ open http://registry.npm.taobao.org/sync/connect

publish / unpublish

Only admin user can publish / unpublish package to private registry.
$ cnpm publish [name]
$ cnpm unpublish
[name]

Other commands

Support all the other npm commands. e.g.:
$ cnpm info cnpm

TODO list

@see Github Issues

Histories

Release History.

npmjs.orgcnpmjs.org and npm.taobao.org relation

如今,美国的月子中心的生意不好做了

月付1.25usd的vps

$
0
0

128mb VPS,
$1.25 /mo.月付。

from https://ipxcore.com/budget-vps/

购物能返现的网站shopback.com

$
0
0
https://www.shopback.com

这不是骗局,这是商家让利,所以是真的。

消失的國界|台商接軌世界(新加坡/泰国越来越牛逼)

铿锵集:青春的眼泪


《三国演义》中细思恐极的细节

$
0
0
简单说,刘备的军师诸葛亮,其实就是逃出许昌的汉献帝——换而言之,有一刻开始,曹操手里的献帝是假的。
试想:刘备是皇叔,汉左将军宜城亭侯领豫州牧,为什么要沐浴更衣去草庐拜访一个村夫?为什么刘备绝不能让张飞动粗,要三个人一起毕恭毕敬地候着?真相只有一个:他们要见的是真的大汉天子,他们行的是朝拜天子的礼仪。再试想:为什么诸葛亮的门童为什么要对刘备说,自己记不得这么多头衔?显然,这位是天子近侍,他必须要先折煞一下外臣、军将的气焰——而这里的童子,说的更多的是声音而不是年龄。
于是很多事情的真相也就水落石出了:为什么在草庐时,诸葛亮足不出户就可以有《隆中对》的视野?因为这许多年来,他坐天下之中,观英雄成败,他看得太清楚了。为什么诸葛亮平居敢自称“卧龙”?为什么刘备临终前会对诸葛亮说,“汝可取而代之”?因为这位就是大汉天子,终究还是汉室天下……
关键在于献帝是如何成功脱身的?脱身之后的他为什么不即刻起兵讨曹?
显然,衣带诏是成功的。献帝——请允许我这样称呼他——从一开始就是杰出的策划师,他的每一滴血都没有白流。刘备接到衣带诏以后,不可能潜逃,他之所以走了,就是因为营救汉帝的计划成功了。曹操毕竟也是高手。他发现真的皇帝不见了,即刻把董承一干人等处决。这样,在许昌的天子近臣都死了,没有人知道献帝长什么样,曹操说是谁就是谁。这步棋,曹操一直很得意——只要假的天子在手,真的天子也不敢贸然出击。他后来回忆道:“外头要是知道皇帝失踪了,不知几人称帝几人称王了。”
献帝离开了许昌。他固然很想即刻召集诸侯,以天子的名义讨曹,但这太危险了。假作真时真亦假——“天子”,某种意义上就在许昌,一个外人突然宣称某人是天子,很可能就是袁术或者艾德·史塔克的下场。是的,在他没有实足的证据或相当的实力之前,各路诸侯都可以宣称他是冒充的,以讨伐叛贼的名义讨伐他。他需要积蓄力量,等待时机——这也是“卧龙”的喻意。而献帝从来是谨慎的——这就是后世说的,“诸葛从来不用险……” 现在,当务之急,他需要投奔一个可靠的人隐居起来。
这个人当然就是刘表。
一则他也是汉室宗亲,再则襄阳毕竟离许昌很近,免去许多周折——事实上,他随时准备着杀回许昌。当然,这件事应该只有刘表、刘备、水镜先生、徐庶、黄承彦等很少人知道。于是,黄承彦把自己的女儿嫁给了献帝,从而巩固荆州集团与献帝之间的合作。而刘备也不惜千山万水,来投奔刘表。一个以南阳为中心的集团就形成了。从这一天起,刘协字伯和就有了一个新的身份,诸葛亮字孔明,他的荆州团队精心为他打造的身份。
刘备劝刘表偷袭许。事实上,这是汉献帝的战略安排。
献帝回到了许都就可以恢复自己的真正身份,召集天下诸侯。以刘关张之勇,统刘荆州之兵,大业可成,汉室可兴!不幸的是,刘表有他自己的算盘。献帝一旦起兵攻许,最后还是他的荆州军与曹操血拼。而知道真相眼泪掉下来的曹操也会把他当做头号敌人。无论最终胜负如何,刘表只是鹬蚌中的一个,而得利的恐怕是刘备或其他诸侯。刘表不愿意冒险,他决定观望。天子是他手中的奇货,他希望在对他更有利的时候撒出去。
刘表的举动让汉献帝大失所望。这让他意识到,他不能只是南阳一届隐士,他必须更进一步,获得一个真正的决策者的身份,投身到这个权力的世界中。
三顾茅庐其实是汉献帝和刘备之间的往返磋商。
经过三轮谈判,双方达成协议:刘备给汉献帝军师的身份,汉献帝从此掌握刘备集团的决策权——甚至刘备很多时候都要服从他的指挥——显然,这会让不了解内情的关张很不满。但汉献帝为此做出了重大让步:他将放弃刘协字伯和的身份,从此诸葛亮字孔明就是他唯一的身份!这意味着,最终继承大汉天子的,将是刘备的后裔,而他,终究是要向刘备下跪的。献帝的内心是痛苦的——但为了大汉天下, 这又算得了什么!
这之前还发生了一个插曲。徐庶的母亲是颍川人,一开始就是汉献帝身边的人,从许昌一直护送献帝到南阳。但曹操的特工抓住了她,掌握了关键线索,开始严刑逼供。这个时候徐庶就只能离开刘备,去许昌处理这次危机。所以徐庶临别的时候说得很隐晦,他说他现在方寸乱了——是的,不止他,整个计划的所有人,心都提到了喉咙口。好在,徐庶出色地处理了这件事。徐母自尽。曹操失去了关键证人,只能设法控制住徐庶。这个过程中,挫败让曹操动了杀心,于是他打算大军南下,擒住诸葛——一切自然水落石出。
于是,改变身份之后的汉献帝终于可以於曹操对决了。他首先火烧博望新野,出了一口恶气,然后,依据他的战略规划,就要联络东吴。这时,他真正担心的事终于被摆到了他的面前:他其实没见过诸葛瑾!虽然他和他的团队早有准备,当一旦当面对质,难免尴尬。所以《三国演义》说:
瑾曰:“贤弟既到江东, 如何不来见我?”孔明曰:“弟既事刘豫州,理宜先公后私。公事未毕,不敢及私。望兄见谅。”
这都是面上的话。诸葛瑾其实说的是:“你谁呀!”献帝说:“我有更重要的事情,你先兜着……我们慢点聊。”现在,整过过程中牵线搭桥的就是鲁肃。在鲁肃等人的牵线搭桥下,孙刘联盟,大破曹军。而诸葛瑾和诸葛亮这对假兄弟,也必须演下去。其实,从名字中还是可以看出破绽的:诸葛“瑾”、诸葛“均”都是斜玉旁——均字少掉的那一横是后世的传抄的遗漏,好比华雄很有可能叫叶雄,就是因为繁体字華和葉相近。显然,诸葛亮与他们不同。亮,字孔明。“孔”其实就是“非常”、“很”的意思,亮、孔明就好比后世所谓的正大光明。孔明也好,卧龙也好,这都是献帝一开始设计好的、标记自己帝王身份的线索。
说来,鲁肃真是一个好人。他也知道,刘备势力太弱了,这个盟友没有什么价值;他也知道,周瑜有很多机会可以干掉诸葛亮,进而瓦解刘备势力。甚至,在他本来的战略规划中,东吴就是要取西川的,孙权就是要称帝的——这里根本就没有刘备的位置。但无奈他知道了内情。天性忠厚的他决定为大汉尽最后一份忠诚,他要保护诸葛亮。而周瑜,当然是斗不过卧龙的。后者是真命天子,他的血可以召唤“神龙”——无论是大雾还是东风……周郎选错了对手。很多年后,当事人都死了,孙权后来知道了其中原委,他感慨周瑜的际遇,又觉得鲁肃这家伙当时背叛了他——说的就是这件事。
之后的事情我们都知道了,刘备每在外作战,诸葛亮总是坐镇中军,这都是一开始约定好的。诸葛亮——也就是大汉真正的天子——会用自己的智慧,重振祖宗的基业!
曹操这边就比较苦闷,他眼巴巴地看着天子溜走了。对于他手里的假“天子”,他一天比一天更加不敬——是的,他无须敬畏,这是他找来的冒牌货——终于荀彧都察觉出了曹操的变化。曹操也是无奈。醉了的时候,他吟道:“月明星稀,乌鹊南飞,绕树三匝,何枝可依?”这南飞的乌雀或许就是溜走的天子吧。“他终究可以依靠谁呢?”曹操问。“山不厌高,海不厌深,周公吐哺,天下归心。”——还是回我这里吧。
然而,渐渐,刘备和诸葛亮(也就是汉献帝)之间产生了裂痕。
一个导火索是刘封事件。刘备处死了这位养子。这不能不让诸葛亮(汉献帝)担心自己的处境。如果刘备开始铲除刘氏成员,以巩固刘禅地位,那么下一个遭殃的职能是诸葛亮自己。在一段时间内,诸葛亮处境相当尴尬。但随着刘备自作主张,夷陵惨败,白帝托孤,一切又回到了一开始的草庐协议下。大败之后的刘备,或许明白了过来:“皇上啊,你的天下,你放开手去取吧。”于是诸葛亮挥师北伐,光复本属于自己的汉室……
他内心的苦闷只有自己知道。《出师表》中,他说了那么许多,最后却说:
临表涕泣,不知所云。
他不知道自己在说什么——因为他说的那些,什么布衣,什么躬耕,其实都不是真的!他也许想说,“真正懂我的人应该知道,我之前讲的那些都毫无意义——你们要像扔掉梯子一样扔掉他们。”但他连这都不能说。一切有意义的,他只有保持沉默。只有他的泪水,这是真的。
眼看着白痴的刘禅,他固然想过恢复自己的身份。但想到当年草庐的约定,想到与刘备之间多年的羁绊,他又有所犹豫。这么多年来,他早已习惯了汉臣的身份。他多么希望自己真的是大汉的丞相啊。九泉之下,背对飘零的汉室,他可以对大汉二十三朝列祖列宗说一声:“臣尽力了!”然而,他不能够。他不只是汉臣,他是大汉第二十四位天子。“为什么偏偏是我,要肩负起扭转乾坤的重任!”——许多许多年后,一位异国的诗人会这样唱道。
现在,他只能步步为营。打算先攻入长安,再加十锡。等出现了五星汇聚、高祖再世的异相,再见机行事——或可以公布自己的真实身份,真正复兴汉室?然而,北伐大军在胜利在望的时候,刘禅却把他召了回来。余下的只有无奈……
与诸葛亮真实身份息息相关的还有两个人:王朗,和司马懿。
作为文武全才,王朗当然有自信拿下这个世界上的任何一个普通人。但诸葛亮不是普通人,他是大汉天子!他正义凛然的一刹那,老臣王朗全都明白了:这根本不是一场舌战,是大汉天子在三军阵前训斥自己!顿时,又是惊,又是喜,又是惧,又是羞愧,又是无措,他再也抑制不住自己的心情——他落马死了,死在他曾经发誓要侍奉的天子面前,死得明白。
还有司马懿。他追到了城楼上,诸葛亮弹了一首只有宫中才有的曲子——是出于震慑?还是要唤起世为汉臣的司马懿的良知?自幼熟悉宫廷乐律的司马懿,瞬间就明白了坊间谣传是真的!他选择退兵。也不知道是因为他内心深处身为汉臣的悸动,还是因为他开始下一盘很大的棋?我们不得而知。但我们知道:后来西晋篡魏之前,首先选择灭蜀,就是想获得诸葛后人,汉室正统,作为可能的一张牌来打。所以,邓艾在杀害诸葛瞻父子之后立刻被做掉了——他哪里知道水有多深;而钟会从姜维那里得知真相之后,也打算自己动手,不幸变成了一出闹剧。这些都是后话了。当然,最后司马氏放弃了诸葛身份的手牌,选择让这件事消失在历史之中。
当然,早先获得了徐庶的曹魏渐渐地也了解了其中隐情,只是将计就计而已。他们并不需要真的献帝,只需要一个人来表演献帝,来完成各种仪式,尤其是最后的禅让。曹操一开始就安排好了。诸葛亮死了以后,假献帝也没有了价值,自然被做掉了。史学家非常隐晦地记载了其中的关系:所以献帝的出身年和诸葛亮也是一样的——对,这就是为什么他们的生卒年是一样的。
说到这里,似乎还有一丝悬念:
诸葛瑾的亲弟弟,诸葛均的亲哥哥,这个人真实存在么?献帝使用了他的身份以后,他到哪里去了?他本来叫什么名字呢?我想,这恐怕就文献不足征了。我倾向于这种理解:这个人原先是存在的。他之后使用了一个化名,叫朱士行。朱士,就是诸葛家族之士的意思;行,就是走了。文献中的朱士行极有可能是真正的诸葛瑾之弟,诸葛均之兄。他去哪里了呢?他出家了。所以,名字里的“行”,也许就是对梵文Tathāgata的一种解读,那样得去了(tathā-gata)——虽然后世习惯理解成那样来了(tathā-āgata),也即如来。无论如何,朱士行是有记载的汉地第一位受比丘戒的出家人。想来他的内心也有许多的凄苦,或许他早已找到了解脱?他的事迹也成为汉地佛教的一个新的开始。
当然,这只是猜测了。
整个蜀汉,为了这个秘密,始终没有建立完整的史官制度。太多往事随风散去,幸而,终有一些蛛丝马迹,长存在史料之中,穿梭在评话与戏剧之间,最终通过罗贯中的笔,汇聚到了《三国演义》之中。有一天,一定有人会找到这些真相。不!自始至终,都有人坚守着真相,坚守着这大汉的秘密。他们,是汉的意志的继承者——譬如,他们中的一个人,我们在电视上早就见过了.

Go命令详解

$
0
0

Go 命令

Go语言自带有一套完整的命令操作工具,你可以通过在命令行中执行go来查看它们:
图1.3 Go命令显示详细的信息
这些命令对于我们平时编写的代码非常有用,接下来就让我们了解一些常用的命令。

go build

这个命令主要用于编译代码。在包的编译过程中,若有必要,会同时编译与之相关联的包。
  • 如果是普通包,就像我们在1.2节中编写的mymath包那样,当你执行go build之后,它不会产生任何文件。如果你需要在$GOPATH/pkg下生成相应的文件,那就得执行go install
  • 如果是main包,当你执行go build之后,它就会在当前目录下生成一个可执行文件。如果你需要在$GOPATH/bin下生成相应的文件,需要执行go install,或者使用go build -o 路径/a.exe
  • 如果某个项目文件夹下有多个文件,而你只想编译某个文件,就可在go build之后加上文件名,例如go build a.gogo build命令默认会编译当前目录下的所有go文件。
  • 你也可以指定编译输出的文件名。例如1.2节中的mathapp应用,我们可以指定go build -o astaxie.exe,默认情况是你的package名(非main包),或者是第一个源文件的文件名(main包)。
(注:实际上,package名在Go语言规范中指代码中“package”后使用的名称,此名称可以与文件夹名不同。默认生成的可执行文件名是文件夹名。)
  • go build会忽略目录下以“_”或“.”开头的go文件。
  • 如果你的源代码针对不同的操作系统需要不同的处理,那么你可以根据不同的操作系统后缀来命名文件。例如有一个读取数组的程序,它对于不同的操作系统可能有如下几个源文件:
    array_linux.go array_darwin.go array_windows.go array_freebsd.go
go build的时候会选择性地编译以系统名结尾的文件(Linux、Darwin、Windows、Freebsd)。例如Linux系统下面编译只会选择array_linux.go文件,其它系统命名后缀文件全部忽略。
参数的介绍
  • -o 指定输出的文件名,可以带上路径,例如 go build -o a/b/c
  • -i 安装相应的包,编译+go install
  • -a 更新全部已经是最新的包的,但是对标准包不适用
  • -n 把需要执行的编译命令打印出来,但是不执行,这样就可以很容易的知道底层是如何运行的
  • -p n 指定可以并行可运行的编译数目,默认是CPU数目
  • -race 开启编译的时候自动检测数据竞争的情况,目前只支持64位的机器
  • -v 打印出来我们正在编译的包名
  • -work 打印出来编译时候的临时文件夹名称,并且如果已经存在的话就不要删除
  • -x 打印出来执行的命令,其实就是和-n的结果类似,只是这个会执行
  • -ccflags 'arg list' 传递参数给5c, 6c, 8c 调用
  • -compiler name 指定相应的编译器,gccgo还是gc
  • -gccgoflags 'arg list' 传递参数给gccgo编译连接调用
  • -gcflags 'arg list' 传递参数给5g, 6g, 8g 调用
  • -installsuffix suffix 为了和默认的安装包区别开来,采用这个前缀来重新安装那些依赖的包,-race的时候默认已经是-installsuffix race,大家可以通过-n命令来验证
  • -ldflags 'flag list' 传递参数给5l, 6l, 8l 调用
  • -tags 'tag list' 设置在编译的时候可以适配的那些tag,详细的tag限制参考里面的 Build Constraints

go clean

这个命令是用来移除当前源码包和关联源码包里面编译生成的文件。这些文件包括
_obj/            旧的object目录,由Makefiles遗留
_test/ 旧的test目录,由Makefiles遗留
_testmain.go 旧的gotest文件,由Makefiles遗留
test.out 旧的test记录,由Makefiles遗留
build.out 旧的test记录,由Makefiles遗留
*.[568ao] object文件,由Makefiles遗留

DIR(.exe) 由go build产生
DIR.test(.exe) 由go test -c产生
MAINFILE(.exe) 由go build MAINFILE.go产生
*.so 由 SWIG 产生
我一般都是利用这个命令清除编译文件,然后github递交源码,在本机测试的时候这些编译文件都是和系统相关的,但是对于源码管理来说没必要。
$ go clean -i -n
cd /Users/astaxie/develop/gopath/src/mathapp
rm -f mathapp mathapp.exe mathapp.test mathapp.test.exe app app.exe
rm -f /Users/astaxie/develop/gopath/bin/mathapp
参数介绍
  • -i 清除关联的安装的包和可运行文件,也就是通过go install安装的文件
  • -n 把需要执行的清除命令打印出来,但是不执行,这样就可以很容易的知道底层是如何运行的
  • -r 循环的清除在import中引入的包
  • -x 打印出来执行的详细命令,其实就是-n打印的执行版本

go fmt

有过C/C++经验的读者会知道,一些人经常为代码采取K&R风格还是ANSI风格而争论不休。在go中,代码则有标准的风格。由于之前已经有的一些习惯或其它的原因我们常将代码写成ANSI风格或者其它更合适自己的格式,这将为人们在阅读别人的代码时添加不必要的负担,所以go强制了代码格式(比如左大括号必须放在行尾),不按照此格式的代码将不能编译通过,为了减少浪费在排版上的时间,go工具集中提供了一个go fmt命令 它可以帮你格式化你写好的代码文件,使你写代码的时候不需要关心格式,你只需要在写完之后执行go fmt <文件名>.go,你的代码就被修改成了标准格式,但是我平常很少用到这个命令,因为开发工具里面一般都带了保存时候自动格式化功能,这个功能其实在底层就是调用了go fmt。接下来的一节我将讲述两个工具,这两个工具都自带了保存文件时自动化go fmt功能。
使用go fmt命令,其实是调用了gofmt,而且需要参数-w,否则格式化结果不会写入文件。gofmt -w -l src,可以格式化整个项目。
所以go fmt是gofmt的上层一个包装的命令,我们想要更多的个性化的格式化可以参考 gofmt
gofmt的参数介绍
  • -l 显示那些需要格式化的文件
  • -w 把改写后的内容直接写入到文件中,而不是作为结果打印到标准输出。
  • -r 添加形如“a[b:len(a)] -> a[b:]”的重写规则,方便我们做批量替换
  • -s 简化文件中的代码
  • -d 显示格式化前后的diff而不是写入文件,默认是false
  • -e 打印所有的语法错误到标准输出。如果不使用此标记,则只会打印不同行的前10个错误。
  • -cpuprofile 支持调试模式,写入相应的cpufile到指定的文件

go get

这个命令是用来动态获取远程代码包的,目前支持的有BitBucket、GitHub、Google Code和Launchpad。这个命令在内部实际上分成了两步操作:第一步是下载源码包,第二步是执行go install。下载源码包的go工具会自动根据不同的域名调用不同的源码工具,对应关系如下:
BitBucket (Mercurial Git)
GitHub (Git)
Google Code Project Hosting (Git, Mercurial, Subversion)
Launchpad (Bazaar)
所以为了go get 能正常工作,你必须确保安装了合适的源码管理工具,并同时把这些命令加入你的PATH中。其实go get支持自定义域名的功能,具体参见go help remote
参数介绍:
  • -d 只下载不安装
  • -f 只有在你包含了-u参数的时候才有效,不让-u去验证import中的每一个都已经获取了,这对于本地fork的包特别有用
  • -fix 在获取源码之后先运行fix,然后再去做其他的事情
  • -t 同时也下载需要为运行测试所需要的包
  • -u 强制使用网络去更新包和它的依赖包
  • -v 显示执行的命令

go install

这个命令在内部实际上分成了两步操作:第一步是生成结果文件(可执行文件或者.a包),第二步会把编译好的结果移到$GOPATH/pkg或者$GOPATH/bin
参数支持go build的编译参数。大家只要记住一个参数-v就好了,这个随时随地的可以查看底层的执行信息。

go test

执行这个命令,会自动读取源码目录下面名为*_test.go的文件,生成并运行测试用的可执行文件。输出的信息类似
ok   archive/tar   0.011s
FAIL archive/zip 0.022s
ok compress/gzip 0.033s
...
默认的情况下,不需要任何的参数,它会自动把你源码包下面所有test文件测试完毕,当然你也可以带上参数,详情请参考go help testflag
这里我介绍几个我们常用的参数:
  • -bench regexp 执行相应的benchmarks,例如 -bench=.
  • -cover 开启测试覆盖率
  • -run regexp 只运行regexp匹配的函数,例如 -run=Array 那么就执行包含有Array开头的函数
  • -v 显示测试的详细命令

go tool

go tool下面下载聚集了很多命令,这里我们只介绍两个,fix和vet
  • go tool fix . 用来修复以前老版本的代码到新版本,例如go1之前老版本的代码转化到go1,例如API的变化
  • go tool vet directory|files 用来分析当前目录的代码是否都是正确的代码,例如是不是调用fmt.Printf里面的参数不正确,例如函数里面提前return了然后出现了无用代码之类的。

go generate

这个命令是从Go1.4开始才设计的,用于在编译前自动化生成某类代码。go generatego build是完全不一样的命令,通过分析源码中特殊的注释,然后执行相应的命令。这些命令都是很明确的,没有任何的依赖在里面。而且大家在用这个之前心里面一定要有一个理念,这个go generate是给你用的,不是给使用你这个包的人用的,是方便你来生成一些代码的。
这里我们来举一个简单的例子,例如我们经常会使用yacc来生成代码,那么我们常用这样的命令:
go tool yacc -o gopher.go -p parser gopher.y
-o 指定了输出的文件名, -p指定了package的名称,这是一个单独的命令,如果我们想让go generate来触发这个命令,那么就可以在当然目录的任意一个xxx.go文件里面的任意位置增加一行如下的注释:
//go:generate go tool yacc -o gopher.go -p parser gopher.y
这里我们注意了,//go:generate是没有任何空格的,这其实就是一个固定的格式,在扫描源码文件的时候就是根据这个来判断的。
所以我们可以通过如下的命令来生成,编译,测试。如果gopher.y文件有修改,那么就重新执行go generate重新生成文件就好。
$ go generate
$ go build
$ go test

godoc

在Go1.2版本之前还支持go doc命令,但是之后全部移到了godoc这个命令下,需要这样安装go get golang.org/x/tools/cmd/godoc
很多人说go不需要任何的第三方文档,例如chm手册之类的(其实我已经做了一个了,chm手册),因为它内部就有一个很强大的文档工具。
如何查看相应package的文档呢? 例如builtin包,那么执行godoc builtin 如果是http包,那么执行godoc net/http 查看某一个包里面的函数,那么执行godoc fmt Printf 也可以查看相应的代码,执行godoc -src fmt Printf
通过命令在命令行执行 godoc -http=:端口号 比如godoc -http=:8080。然后在浏览器中打开127.0.0.1:8080,你将会看到一个golang.org的本地copy版本,通过它你可以查询pkg文档等其它内容。如果你设置了GOPATH,在pkg分类下,不但会列出标准包的文档,还会列出你本地GOPATH中所有项目的相关文档,这对于经常被墙的用户来说是一个不错的选择。

其它命令

go还提供了其它很多的工具,例如下面的这些工具
go version 查看go当前的版本
go env 查看当前go的环境变量
go list 列出当前全部安装的package
go run 编译并运行Go程序
以上这些工具还有很多参数没有一一介绍,用户可以使用go help 命令获取更详细的帮助信息。

links


from  https://github.com/astaxie/build-web-application-with-golang/blob/master/zh/01.3.md

如何编译、打包go语言(golang)的源代码详见:http://golang.org/doc/code.html

消失的国界| 台商在美/加拓荒赚美金

消失的國界 | 以色列與巴勒斯坦的國仇家恨

$
0
0

片中描述到的无人驾驶汽车的处理器研发公司mobileye的网站:http://www.mobileye.com

OpenVPN-Monitor

$
0
0
openvpn-monitor is a web based OpenVPN monitor, that shows current connection information, such as users, location and data transferred

Summary

OpenVPN-Monitor is a simple python program to generate html that displays the status of an OpenVPN server, including all current connections. It uses the OpenVPN management console. It typically runs on the same host as the OpenVPN server, however it does not necessarily need to.

Source

The current source code is available on github:

Installation with virtualenv + pip + gunicorn

N.B libgeoip-dev should also be installed using yum/apt-get
mkdir /srv/openvpn-monitor
cd /srv/openvpn-monitor
virtualenv .
. bin/activate
pip install openvpn-monitor gunicorn
gunicorn openvpn-monitor -b 0.0.0.0:80

Installation with Docker

docker run -p 80:80 ruimarinho/openvpn-monitor
Read the docker installation instructions for details on how to generate a dynamic configuration using only environment variables.

Standard Installation

Install dependencies and configure apache

Debian / Ubuntu

apt-get -y install python-geoip python-ipaddr python-humanize python-bottle python-semantic-version apache2 libapache2-mod-wsgi git wget
echo"WSGIScriptAlias /openvpn-monitor /var/www/html/openvpn-monitor/openvpn-monitor.py"> /etc/apache2/conf-available/openvpn-monitor.conf
a2enconf openvpn-monitor
systemctl restart apache2

CentOS

yum install -y epel-release
yum install -y python-GeoIP python-ipaddr python-humanize python-bottle python-semantic_version httpd mod_wsgi git wget
echo"WSGIScriptAlias /openvpn-monitor /var/www/html/openvpn-monitor/openvpn-monitor.py"> /etc/httpd/conf.d/openvpn-monitor.conf
systemctl restart httpd

Checkout OpenVPN-Monitor

cd /var/www/html
git clone https://github.com/furlongm/openvpn-monitor.git

Configure OpenVPN

Add the following line to your OpenVPN server configuration to run the management console on 127.0.0.1 port 5555:
management 127.0.0.1 5555
Refer to the OpenVPN documentation for further information on how to secure access to the management interface.

Download the GeoLite City database

cd /usr/share/GeoIP/
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gunzip GeoLiteCity.dat.gz
mv GeoLiteCity.dat GeoIPCity.dat

Configure OpenVPN-Monitor

The example configuration file /var/www/html/openvpn-monitor/openvpn-monitor.conf should give some indication of how to set site name, add a logo, etc. You can also set a default location (latitude and longitude) for the embedded maps. If not set, the default location is Melbourne, Australia.
Edit /var/www/html/openvpn-monitor/openvpn-monitor.conf to match your site.
You should now be able to navigate to http://myipaddress/openvpn-monitor

Debugging

OpenVPN-Monitor can be run from the command line in order to test if the html generates correctly:
cd /var/www/html/openvpn-monitor
python openvpn-monitor.py
Further debugging can be enabled by specifying the --debug flag:
cd /var/www/html/openvpn-monitor
python openvpn-monitor.py -d
from https://github.com/furlongm/openvpn-monitor

基于nodejs的模拟linux系统-NightOS

$
0
0
Powerful and safe operating system based on Linux.

NightOS Logo
NightOS is a desktop environment which is based on a custom Linux distribution. It uses the Electron and NodeJStechnology to access the filesystem, manage the network connections, and manage applications safely.

How does it work?

NightOS works as a very large JavaScript application, that runs on a Linux + Electron base. This project aims to demonstrate the power of JavaScript by making a full O.S. with this language, so the most tasks that can be handled by it will be done using JS. The Linux system works as an interface, a layer that allows JavaScript to manage the network connections, access the hard drive, and some other low-level things.

What? (Again) Another O.S.? For what purpose?

NightOS is a purely theorical operating system. I don't know if I'll make a working version of NightOS one day, and even if I do, that will be a very unsecured O.S. because I don't know many things about programming security (even basic things such as buffer overflows, ROPs...) ; in fact the only security techs I know about are general things like encryption, certificates, checksums and IPC for example - not enough at all for a full system.
In fact, I made NightOS more for fun and using more deep JavaScript and Node.js features. I do not aim at all to make a better O.S. than Windows, Mac or Linux - not even making an alternative to them. Making an O.S. full of JavaScript is simply not possible due to many problems, like the slow speed of JS in front of native languages like C++ or Rust, and the problem for developpers to port their applications to NightOS (even if there are tools for that, like Emscripten).
It's also a way to demonstrate the power of the JavaScript language, which is I think the most misunderstood one in the development world. By making a system fully functionnal that manages a Linux system, applications, a desktop environment, multiple user accounts, several processes, a large API and processes isolation, I think this could be a great proof that JavaScript is a powerful language - when you understand it and know how to use its deep features.

Differences with the previous versions of the system

I published two previous versions of NightOS. You can find them on my GitHub: v1 and v2.
v1 has a lot of problems, and v2 was not enough complete to be an operating system. So I decided to restart the project from scratch, and keeping just the main ideas of the project (a really strong security, permissions for apps...) and I made this new version of NightOS.
There's some similar points with the older versions: the system still works with applications, that need permissions in order to access the storage/web/manage windows/... but now the permissions system is much stronger, much permissive and it's now possible to make unpackaged applications, programs that run without having to be installed (like .exe on Windows, but with permissions).
So, even if you find the two old versions really bad, this one is very different, so I hope you'll enjoy it ;) !

Computer requirements

NightOS can run on any low-end computers. You don't have to worry about the performances of your machine. If you really want to have specifications, here there are:
  • At least 200 Mb of free RAM, 500 Mb recommended ;
  • Any low-end processor ;
  • A hard drive (that would be nice), a mouse, a keyboard and a screen.
That's all! Relax and enjoy :).

Installation

Installation requires NodeJSNPM and Git installed on your machine. On Linux, you can run sudo apt-get install nodejs npm git. On Windows, simply visit these three websites to get the installation programs of each software.
To install NightOS, open a command-line and run the following code :
git clone https://github.com/ClementNerma/NightOS # Download NightOS
cd NightOS # Go to the NightOS directory
npm install # Install the npm dependencies
npm start # Start NightOS ; `node start.js` also works
You can also run NightOS in development mode (see more in the docs):
# The simple way
npm run dev
from https://github.com/ClementNerma/NightOS

一个基于Ruby on Rails的社交网站程序-socify

$
0
0
Socify is an open source social networking platform written in Ruby on Rails.

Socify is an open source social networking platform written in Ruby on Rails. Here is the blog post: How to build a social network using Rails.
Heroku
Do you want to see it in action? Here is a working version deployed to heroku http://socifyapp.herokuapp.com

UPDATE

Since my cloudinary free tier hit a bandwidth overload. So had to switch to AWS. If you plan on deploying to production please set the AWS key and secret as environment variables. Or you can checkout the older version which uses cloudinary https://github.com/sudharti/socify/tree/930b2f7c6a6eb6b442189dc6237765dbf16d461c

UPDATE #2

Updated the Rails version to 5.0. Thanks to @briankung for the Pull Request. There are some more things to be upgraded which will be done shortly. Refer this for the list of changes to be done https://hashrocket.com/blog/posts/how-to-upgrade-to-rails-5.

What it uses?

How do I get set up?

To set it up on your local machine here is what you need to do. Install Ruby & Rails. Clone this repo using the following command:
git clone https://github.com/sudharti/socify
cd socify
Then resolve dependencies using bundler:
bundle install
Run Migrations:
rake db:migrate
Run rails using
rails server

Populate Mock data

To test the app with mock data by running the following rake task:
rake fill:data
This will create records with values from faker & populator gems. Also here are the test user credentials:

Screenshots

indexhomeprofilepostfind_friends

Pull Requests

  • Fork this repo
  • Make changes to code
  • Send Pull Request

Issues

If you find any issue with the app please do raise an issue here https://github.com/sudharti/socify/issues
from https://github.com/scaffeinate/socify
https://github.com/sudharti/socify

一个基于python的群聊程序-Zulip

$
0
0
powerful open source group chat.
Zulip is a powerful, open source group chat application. Written in Python and using the Django framework, Zulip supports both private messaging and group chats via conversation streams.
Zulip also supports fast search, drag-and-drop file uploads, image previews, group private messages, audible notifications, missed-message emails, desktop apps, and much more.
Further information on the Zulip project and its features can be found at https://www.zulip.org.
Build Status Coverage Status Mypy coverage docs Zulip chat Twitter

Community

There are several places online where folks discuss Zulip.
  • The primary place is the Zulip development community Zulip server at chat.zulip.org.
  • For Google Summer of Code students and applicants, we have a mailing list for help, questions, and announcements. But it's often simpler to visit chat.zulip.org instead.
  • We have a public development discussion mailing list, zulip-devel, which is currently pretty low traffic because most discussions happen in our public Zulip instance. We use it to announce Zulip developer community gatherings and ask for feedback on major technical or design decisions. It has several hundred subscribers, so you can use it to ask questions about features or possible bugs, but please don't use it ask for generic help getting started as a contributor (e.g. because you want to do Google Summer of Code). The rest of this page covers how to get involved in the Zulip project in detail.
  • Zulip also has a blog and twitter account.
  • Last but not least, we use GitHub to track Zulip-related issues (and store our code, of course). Anybody with a GitHub account should be able to create Issues there pertaining to bugs or enhancement requests. We also use Pull Requests as our primary mechanism to receive code contributions.
The Zulip community has a Code of Conduct.

Installing the Zulip Development environment

The Zulip development environment is the recommended option for folks interested in trying out Zulip. This is documented in the developer installation guide.

Running Zulip in production

Zulip in production supports Ubuntu 14.04 Trusty and Ubuntu 16.04 Xenial. Work is ongoing on adding support for additional platforms. The installation process is documented at https://zulip.org/server.html and in more detail in the documentation.

Ways to contribute

Zulip welcomes all forms of contributions! This page documents the Zulip development process.

Google Summer of Code

We participated in GSoC in 2016 (with great results) and are participating in 2017 as well.

How to get involved with contributing to Zulip

First, subscribe to the Zulip development discussion mailing list.
The Zulip project uses a system of labels in our issue tracker to make it easy to find a project if you don't have your own project idea in mind or want to get some experience with working on Zulip before embarking on a larger project you have in mind:
  • Integrations. Integrate Zulip with another piece of software and contribute it back to the community! Writing an integration can be a great first contribution. There's detailed documentation on how to write integrations in the Zulip integration writing guide.
  • Bite Size: Smaller projects that might be a great first contribution.
  • Documentation: The Zulip project loves contributions of new documentation.
  • Help Wanted: A broader list of projects that nobody is currently working on.
  • Platform support: These are open issues about making it possible to install Zulip on a wider range of platforms.
  • Bugs: Open bugs.
  • Feature requests: Browsing this list can be a great way to find feature ideas to implement that other Zulip users are excited about.
  • 2016 roadmap milestone: The projects that are priorities for the Zulip project. These are great projects if you're looking to make an impact.
Another way to find issues in Zulip is to take advantage of our area:<foo> convention in separating out issues. We partition all of our issues into areas like admin, compose, emoji, hotkeys, i18n, onboarding, search, etc. Look through our list of labels, and click on some of the area: labels to see all the tickets related to your areas of interest.
If you're excited about helping with an open issue, make sure to claim the issue by commenting the following in the comment section: "@zulipbot claim". @zulipbot will assign you to the issue and label the issue as in progress. For more details, check out @zulipbot.
You're encouraged to ask questions on how to best implement or debug your changes -- the Zulip maintainers are excited to answer questions to help you stay unblocked and working efficiently. It's great to ask questions in comments on GitHub issues and pull requests, or on chat.zulip.org. We'll direct longer discussions to Zulip chat, but please post a summary of what you learned from the chat, or link to the conversation, in a comment on the GitHub issue.
We also welcome suggestions of features that you feel would be valuable or changes that you feel would make Zulip a better open source project, and are happy to support you in adding new features or other user experience improvements to Zulip.
If you have a new feature you'd like to add, we recommend you start by opening a GitHub issue about the feature idea explaining the problem that you're hoping to solve and that you're excited to work on it. A Zulip maintainer will usually reply within a day with feedback on the idea, notes on any important issues or concerns, and and often tips on how to implement or test it. Please feel free to ping the thread if you don't hear a response from the maintainers -- we try to be very responsive so this usually means we missed your message.
For significant changes to the visual design, user experience, data model, or architecture, we highly recommend posting a mockup, screenshot, or description of what you have in mind to the #design stream on chat.zulip.org to get broad feedback before you spend too much time on implementation details.
Finally, before implementing a larger feature, we highly recommend looking at the new feature tutorial and coding style guidelines on ReadTheDocs.
Feedback on how to make this development process more efficient, fun, and friendly to new contributors is very welcome! Just send an email to the zulip-devel list with your thoughts.
When you feel like you have completed your work on an issue, post your PR to the #code review stream on chat.zulip.org. This is our lightweight process that gives other developers the opportunity to give you comments and suggestions on your work.
from https://github.com/zulip/zulip

安全的通讯/聊天程序-wire

$
0
0
Wire for Web — Modern communication. Full privacy. 

This repository is part of the source code of Wire. You can find more information at wire.com or by contacting opensource@wire.com.
You can find the published source code at github.com/wireapp/wire.
For licensing information, see the attached LICENSE file and the list of third-party licenses at wire.com/legal/licenses/.
If you compile the open source software that we make available from time to time to develop your own mobile, desktop or web application, and cause that application to connect to our servers for any purposes, we refer to that resulting application as an “Open Source App”. All Open Source Apps are subject to, and may only be used and/or commercialized in accordance with, the Terms of Use applicable to the Wire Application, which can be found at https://wire.com/legal/#terms. Additionally, if you choose to build an Open Source App, certain restrictions apply, as follows:
a. You agree not to change the way the Open Source App connects and interacts with our servers; b. You agree not to weaken any of the security features of the Open Source App; c. You agree not to use our servers to store data for purposes other than the intended and original functionality of the Open Source App; d. You acknowledge that you are solely responsible for any and all updates to your Open Source App.
For clarity, if you compile the open source software that we make available from time to time to develop your own mobile, desktop or web application, and do not cause that application to connect to our servers for any purposes, then that application will not be deemed an Open Source App and the foregoing will not apply to that application.
No license is granted to the Wire trademark and its associated logos, all of which will continue to be owned exclusively by Wire Swiss GmbH. Any use of the Wire trademark and/or its associated logos is expressly prohibited without the express prior written consent of Wire Swiss GmbH.

How to build the open source client

Build

Installation

  1. Install Node.js
  2. Install Yarnnpm install -g yarn
  3. Run yarn

Execution

Run yarn start and Wire's web app will be available at: http://localhost:8888/auth/#login
To login with your existing Wire account use: http://localhost:8888/auth/?env=prod#login
from https://github.com/wireapp/wire-webapp
---------
Overview of the open source code for Wire 

Open source

The privacy page and the privacy and security whitepapers explain the details of the encryption algorithms and protocols used.
For licensing information, see the attached LICENSE file and the list of third-party licenses at wire.com/legal/licenses/.
If you compile the open source software that we make available from time to time to develop your own mobile, desktop or web application, and cause that application to connect to our servers for any purposes, we refer to that resulting application as an “Open Source App”. All Open Source Apps are subject to, and may only be used and/or commercialized in accordance with, the Terms of Use applicable to the Wire Application, which can be found at https://wire.com/legal/#terms. Additionally, if you choose to build an Open Source App, certain restrictions apply, as follows:
a. You agree not to change the way the Open Source App connects and interacts with our servers; b. You agree not to weaken any of the security features of the Open Source App; c. You agree not to use our servers to store data for purposes other than the intended and original functionality of the Open Source App; d. You acknowledge that you are solely responsible for any and all updates to your Open Source App.
For clarity, if you compile the open source software that we make available from time to time to develop your own mobile, desktop or web application, and do not cause that application to connect to our servers for any purposes, then that application will not be deemed an Open Source App and the foregoing will not apply to that application.
No license is granted to the Wire trademark and its associated logos, all of which will continue to be owned exclusively by Wire Swiss GmbH. Any use of the Wire trademark and/or its associated logos is expressly prohibited without the express prior written consent of Wire Swiss GmbH.

Build your own Wire client

iOS

Android

Desktop

Wire for Web

Components

AVS

The audio, video, and signaling (AVS) library of Wire is developed in ANSI C/C++. The code is cross compiled for Android and iOS. Wrappers for interaction with upstream modules are written in Java for Android and Objective-C for iOS.

Repositories

  • avs: Audio-video library for calling (mostly C), then cross compiled for iOS and Android

Proteus/Cryptobox

The Axolotl protocol implementation and other cryptographic and utility libraries are developed in Rust, then cross-compiled for iOS and Android. The web version has its own port of these libraries in JavaScript.

Repositories

  • proteus: Axolotl Protocol Implementation in Rust, then cross compiled for iOS and Android
  • cryptobox: High-level API with persistent storage for proteus
  • cryptobox-haskell: Haskell bindings to cryptobox
  • cryptobox-c: C-FFI to cryptobox
  • hkdf: HKDF implementation (RFC 5869) in Rust, then cross compiled to iOS and Android

Server

The Wire server components can be found in the wire-server repository.

Common definitions

Protocol buffer definitions are used by all clients to communicate with each other and with the backend.

Repositories

  • generic-message-proto: Protocol buffer definitions that are part of the cross-platform client communication protocol
  • backend-api-protobuf: Protocol buffer definitions that are part of the backend communication protocol
from https://github.com/wireapp/wire
---------

https://app.wire.com/auth/
https://wire.com/en/
(https://itunes.apple.com/app/wire/id931134707?mt=12)

晚清宪政二三事

$
0
0

中国的宪政梦,在晚清就开始做了。而且有过实践。但直到现在,一百多年过去了,仍然还是个梦。
悲哀啊!
光绪三十四年,是一九零八年。当年,宪政编查馆、资政院王大臣奕劻、溥伦等会奏,进呈宪法、议院、选举各纲要,建议朝廷在议院未开以前,逐年应行筹备。光绪皇帝与八月初一日钦命:“该王大臣所拟宪法暨议院、选举各纲要,条理详密,权限分明,兼采列邦之良规,无违中国之礼教,要不外乎前次迭降明谕,大权统於朝廷,庶政公诸舆论之宗旨。将来编纂宪法暨议院、选举各法,即以此作为准则,所有权限悉应固守,勿得稍有侵越。”
从“兼采列邦之良规,无违中国之礼教”数语,可见光绪皇帝在当时便有了对普世价值的认知,并愿意与国际“良轨”接轨。
早在光绪三十一年,清政权就向全国民众宣布,将施行新政,实行“预备立宪”,并颁布了九年预备立宪诏。
可以说,这是中国民主立宪的最先开端。
与此同时,清政权模仿西方立宪制国家国会的咨议局,开始逐步在各省筹设。
由于光绪不幸死亡,立宪大政被朝廷中的保守派阻扰耽搁。
到宣统元年,面对当朝三四岁的皇帝,民主立宪呼声日渐高涨,搁置多年的民主立宪提案,再度被各地提请。
朝廷无奈,由咨议局出面向各省咨议局颁发选举议员公文。清朝廷没说这个“民主立宪提案”是反朝廷的,不仅没有镇压,反而下文同意,颇为让人不解。
当时,湖南邵阳新宁县,在当年元旦前后,接到省咨议局颁发选举议员的公文。
知县吴友竹,与刑名师爷陈天锡二人,经过悉心细览研究,对于如何设立机构,如何委任人员,如何产生被选举人,皆了然于心,即着手进行。参照咨议局行文精神,地方产生的被选举人必须是当地士绅,严禁官吏参与。注意,严禁官吏参与!
嘿嘿!
因为只有这样,才符合宪政民治精神。
而且,担任审查、复查选举人资格的人选,要以公正干练为准。
新宁县此事办理结果,初定选举人约一千,复查其中有吸大烟者约二、三百人被剔除,实得七百余人参加选举议员。
其他县与新宁无异,只是人数按比例多于新宁。新宁有人不服,要增加选举人,知县吴友竹以宁少勿滥未允。
国家要预备立宪,除原有之咨议局,又在各省新设调查局。
调查局下文,所调查内容,有气候、地理、物产、人口田赋、政治民情、民俗文风,可以说应有尽有,颇具现代科学精神。
新宁县刑名师爷陈天锡,此时正在吃紧办理咨议局选举一事,调查局此文下发,并附有调查表格,且限令按时填报,把他忙得焦头烂额。
这些表格,显然由西方引进,其中气候(含气温、雨量)、人口(含生育、外流、死亡)、土地面积(含森林、荒山、水面)等数据。在斯时斯地,并没有那些简单的科学实验仪器,根本无法精确统计。
因此,填表之人曾流传笑话曰:“临表泣涕,不知所云。”
“临表涕泣,不知所云”,源出诸葛亮《出师表》。本为自谦之词,谓自己已经思绪紊乱,不知道说了些什么。今用在此处,成为“不知道你在说些什么”,让人喷饭。
最后,各县对这些无法填报的内容,均作敷衍了事,上峰也未追究他们责任。
清朝廷推行宪政的内因,源于庚子拳乱后,堂堂大清皇室,竟然在为数不多的外国军队威胁下,仓皇离宫逃难,他们对此不可能没有羞耻感。西太后逃难归来,痛定思痛,开始革新自强。
将晚清推行宪政,说成是统治阶级糊弄百姓玩弄的手段,是不严肃的。
一九零五年七月,清廷派出五大臣出国考察宪政,使朝廷中的高层人士看见了中国和外国的差距。他们回来后,清朝廷听取了他们的建议,预备立宪。行文要求各省选定咨议局,朝廷也组成资政院,定在一九零八年颁布《钦定宪法大纲》。规定立宪时间预备期为九年,并决定在一九一六年正式召开国会。
朝廷谕令各省设立咨议局,明令咨议局为民治机关。咨议员由人民按照选举法选举,议长由议员公选,并规定不许官员参加。
此为中国人第一次有了选举权。
民众所选举的议员,都是地方素有声望,品行端正之人,连吸鸦片烟者都不能当选议员,可见把关之严。各地所选议员,大都为乡绅、学子,地方名流。这些人今番能参政议政,自然能提出很多实际有效的行政建议。
后来各地咨议局对朝廷和地方官的建议太多,地方官对于咨议局已觉头痛。惟朝廷已经准予民选之故,奈何不得,只好敷衍。
官员们并非真正尊重民意。
清朝廷亦怕议员得寸进尺,时以为虑。
后有咨议员认为朝廷以九年时期实施立宪,期限太长,主张缩短年限,并联合各省咨议局进京向清朝廷请愿,请缩短立宪年限。
清朝廷对各地咨议局,本有戒心,见这次竟来直接干预朝廷大政,更加厌恶。下文答曰,似这等立宪大事岂可儿戏?朝令暮改,成何体统?
已定年限不能更改,代表们不满。于是就情愿,但朝廷拒绝请愿,更令代表们寒心。
当时,清朝廷宪法草案已成,国会已开始建筑,立宪年限缩短几年,也没有什么关系。这些咨议员本来大都是主张君主立宪的温和派,哪知朝廷中的保守派,对他们温和的建议竟不赞成,代表们很不满。
后来朝廷发昏,竟动用警察厅劝令代表出京。代表不从,警察厅便下令强行将他们递解回籍。
这就激怒了各省咨议员,认为政府不讲民意,成立咨议局是玩弄权术。于是各省本来主张君主立宪的咨议员,后来有许多反而变为排满的革命者了。
戊戌百日维新虽未成功,换来慈禧的九年立宪,也可以说是有失有得。
可惜九年立宪喧传一时,终成画饼。
咨议员以拥护君主立宪始,而以造反革命终。朝廷中很多有识之士,对此言之痛心。
后来慈禧、光绪死后,清廷皇族中其他人执意要收回皇权,消弱地方权力,这就更加冷了新派和汉人官僚的心,更冷了立宪派人士的心。
满清朝廷,把自己人逼向反面。
本来就政权不稳,四面楚歌,这一来火上加油,他们自己提前敲响了清朝皇室政权的丧钟。
于是,在暴力的辛亥革命到来的时候,朝廷豢养的那些文武大臣们,袖手旁观者多,临危受命者少。有人还帮着起哄,甚至参加了这场革命。
孙中山领导的辛亥革命,虽然广州起义一败涂地,只留下了七十二烈士的英名浩气,但几个月后的武昌起义,则一哄而夺下了武汉三镇,大获全胜。
继而全国响应,几乎兵不血刃,一举推翻了貌似强大的满清政府。
这一切绝不是侥幸,而是历史必然.
--------

自从共匪上了台,历史是大倒退。

笑蜀:朝核危机或彻底终结雅尔塔体制,人类进入全球乱世

$
0
0
如果说1979年苏联出兵阿富汗表明二战后苏联对外扩张政策达到顶点,那么,2003年美国第二次出兵伊拉克,摧毁萨达姆政权,则标志美国全球霸权政策到达顶点,尤其对外输出民主到达顶点。但美国的盛极而衰,从对外扩张转向全面收缩,则经历了一个相对漫长的时期,一直到今天,都还没有尘埃落定,因为美国并不甘心,内部一直在争议、挣扎之中,并由此导致了剧烈的动荡与巨大的悬念。
但是,如果美国对朝鲜核武危机最终无所作为,让朝鲜核武最终生米煮成熟饭,美国和全世界都不得不最终接受朝鲜核武的既成事实,接受朝鲜作为世界核武俱乐部的一员,那么,美国内部关于是否从全球收缩的一切争议、挣扎,就不再有实际意义或者说影响了,事实会做出最终的裁决。不能说美国从此不再是世界强国,美国毫无疑问仍是世界强国,但其强度会大大不同。美国从前的权威可能一去不复返,美国可能被全世界看轻,美国的全球霸权的基础將根本动摇,美国也就无非是一个普普通通的强国罢了。从过去的众王之王,沦落为众王中王。
如此,世界將没有霸主,因为美国的霸主地位不可替代。这点上朝核危机本身就是明证。美国固然面对朝鲜的咄咄逼人步步退让,除了口炮,束手无策。但其他国家又如何?任何其他国家有办法么?更具体地说,朝核危机不止针对美国,更针对中国,更是对中国的羞辱和对中国国家安全的最大威胁。但是,恰恰在这关头,中国提醒全世界尤其提醒美国,不要高估中国对朝鲜的影响力,换句话说,中国也并不更高明。迫在眉睫的朝核危机上如此,其他国际问题也如此,整个国际关系和国际经济秩序都如此。中国有钱,中国崛起,GDP总量世界老二,这都没错,但这不足以构成中国从美国手中接管全球秩序的实力,当世界霸主,中国离这步还有十万八千里呢。
这才是朝核危机的所有危机中,最最最深刻的危机,即它不只是对美国的挑战,对中国的挑战,对日本的挑战,诸如此类。它不只是对哪个国家或者说对哪一些国家的挑战,它的挑战也不只是来自其原子弹、氢弹、中程制导导弹、远程制导导弹本身的杀伤力,而是它对整个国际关系和国际经济秩序的巨大威胁,它对整个人类的巨大威胁。
更具体地说,是对残存的雅尔塔体制的最后一击,是压垮雅尔塔体制的最后一根稻草。
通常认为,苏东解体之后,雅尔塔体制就已经终结了,对这说法我是碍难苟同的。因为所谓雅尔塔体制,不仅包括世界范围的两极对抗即美苏对抗,还包括美国的超强地位,还包括联合国体制。显然,苏东解体只是终结了两极对抗,美国的超强地位,以及联合国体制,并没有大的变化。就此来说,雅尔塔体制仍具生命力,所以,雅尔塔体制确立的全球秩序还管用,世界没有乱套。
但是,朝核危机之后,情况大不同。朝核危机发生发展的过程,就是美国全球超强地位逐步衰落的过程,也是联合国体制逐步衰败的过程。如果朝核危机最终无解,朝鲜真的成了世界核武俱乐部的一员,则无异于对美国超强地位衰落、联合国体制衰败的最终确认。这点上將不再有任何悬念。这將是对残存的雅尔塔体制的毁灭性打击,后果之惨烈超过当年的苏东解体。
今天回头看,不能不承认,这主要是美国当年种下的苦果。苏东解体之后,全世界的自由民主阵营一片狂欢,而有福山著名的“历史的终结”之说,认为人类进入了全球性自由民主的时代。正是在狂欢之中,美国政府加大了对外输出民主的力度,决定向中东输出民主。这才有了第二次海湾战争,有了伊拉克的萨达姆政权的垮台。这是美国政府具体讲是时任美国总统的老布什犯下的致命错误,激怒了几乎整个伊斯兰世界,而有今天的中东乱局甚至世界范围的宗教冲突、种族冲突。美国陷入了一场没有尽头的、它根本耗不起也不可能有任何国家耗得起的超限战之中。直到今天,美国终于千疮百孔筋疲力竭。
这是朝鲜走上核武不归路最重要的背景。没有老布什任上向中东输出民主这一美国全球战略的重大转移,就不可能有朝鲜发展核武的国际空间。所以,今天的朝核危机,在第二次海湾战争打响的那一刻,其实就已经注定。等到今天,美国终于发现这一战略错误,为时已晚,千疮百孔筋疲力竭的美国事实上已经无力回天。
这就意味着,美国將很可能再做不了世界警察,号称世界老二的中国也不可能做得了。其他国家就不用提了。即从此之后,世界將很可能没有警察,世界將很可能进入无政府状态。
世界没有警察,世界无政府状态,这会是人类的福音么?当然不是。想想吧,上个世纪前半叶,不正是因为世界没有警察,世界无政府状态,才导致了两次世界大战,让全世界血流成河么?今天的世界局势,比之两次大战前,难道不是严峻得多么?核扩散、恐怖主义、种族冲突、宗教冲突、族群冲突……,实际上国际秩序已经乱了,好在美国无论怎样千疮百孔筋疲力竭,都还在咬紧牙关支撑,至少装出一副自己在支撑的样子。所以国际秩序虽然乱了,但还没有大乱,大体上还属于一种隐性的乱世,大致的秩序还是有的,表面上过得去。但川普上台之后,连装都不肯装了,干脆就告诉全世界:别指望我,大家伙儿自顾自吧。但因为美国内部对此争议巨大,川普此举在美国似乎并非共识,所以全世界对美国多少都还有点幻想。
就在这时,朝鲜加快了核武化的进程,实际是开始了核武大跃进,终于有了前几日震惊世界的空前程度的核试验。事已至此,如果美国还不能有切实的措施来应对朝鲜的核武化,终结朝核危机,而是听任朝鲜走完核武化的最后一公里,那么罩着美国的最后一层面纱就彻底掉了,就等于告诉全世界,美国真的撑到极限了,真的再撑不下去了。
这是一个绝不能打开的潘多拉盒子,一旦打开,一切不可预料。所以,所谓朝核危机,其实不是朝核危机,准确地说,其实是人类危机。如果这关过不去,世界不会再好起来,以往的时代,將是我们在余生中不断流连忘返的美好回忆。
----------

“这是一个绝不能打开的潘多拉盒子,一旦打开,一切不可预料。所以,所谓朝核危机,其实不是朝核危机,准确地说,其实是人类危机。如果这关过不去,世界不会再好起来,以往的时代,將是我们在余生中不断流连忘返的美好回忆。”- 唉,美国还犹豫什么,不惜一切代价,解决朝鲜这个疯子。
共匪这个猪,共匪这回终于当了一次猪,不久的未来就会尝到养虎为患的恶果。金三胖发起疯来,往中国东北/韩国各扔一颗核弹,你别以为这不可能发生。

谁敢挑战朝鲜的核力量?

$
0
0
美国会动手铲除朝鲜的核武器吗?如果美国这样做,就要准备同朝鲜打一场核战争。当然,这场战争规模不大,力量十分不对等,对美国而言,胜利将无悬念,但代价却可能非常大。美国的决策者对此将十分谨慎,不可能甘冒这样的战略风险。

谁敢挑战朝鲜的核力量?

朝鲜进行了第六核试验,这可能是一次几十万吨级的热核武器试验,威力空前,笔者在哈尔滨都感受到了这次爆炸所引发的动感。半岛局势至此已经非常明朗,可以用三个“毋庸置疑”来概括:

其一,朝鲜已经拥有了威力巨大的核打击力量,这一点毋庸置疑

其二,如果把朝鲜逼到生死存亡边缘,金三胖政权很可能铤而走险使用核武器,这一点也毋庸置疑

其三,朝鲜已下定决心要玩命到底,不惜同归于尽,这也是千真万确、毋庸置疑的了。

现在的问题是,面对这样的朝鲜,还有谁敢无所畏惧地去死磕对决呢?
首先,韩国不敢.

在朝鲜的核火力面前,韩国不过如同纸糊的老虎,会瞬间就被烧得干干净净。真实的情况是,现如今韩国除了瑟瑟发抖之外,毫无办法,虽然一直都在大声叫嚷吵闹,其实不过如同在黑夜里大声咳嗽给自己壮胆罢了。至于前几天传出来什么还要单独北上统一半岛,真可谓说大话救命。
其次,日本也会小心

前几天,朝鲜发射了中远程弹道导弹,于是日本上下大吵大闹,弄出了一个所谓朝鲜导弹“飞跃日本上空”的命题,喧嚣不休。事实上,这是一个伪命题。按照国际法,大气层外的空间是国际公共空间,任何人都有“航行自由”。朝鲜发射的导弹在日本上空500公里以上,这个空间同日本毫无关联,朝鲜的导弹可以在此飞行,其它任何一个国家的导弹或卫星也都可以在此飞行。世界上那么多火箭发射,发射了那么多低轨道卫星,都需要飞跃其它国家的上空,这完全是正常的事。

可是,在“国际社会”的怂恿下,日本上下把朝鲜的导弹发射炒作成了“飞跃日本上空”,俨然侵犯日本一般。中国的一些“专家”、“学者”也跟风,弄出什么“日本为什么不拦截”的题目来讨论。笔者以为,一是日本不能拦截,且不说日本有没有这个能力,即使有,也不能拦截,因为这没有任何理由与根据;二是日本也不敢拦截,因为如果这样做,就等于是同朝鲜进入了战争状态,把金三胖惹急了,给东京来上一颗核炸弹,让日本再挨一次核打击,日本可怎么办呢?真的指望美国会为了日本而不惜与朝鲜以死相拼吗?日本人历来很鬼,它不敢也不想去把朝鲜的核打击招惹到自己头上。


最后,美国不可能冒险同朝鲜打一场核战争

美国会动手铲除朝鲜的核武器吗?如果美国这样做,就要准备同朝鲜打一场核战争。当然,这场战争规模不大,力量十分不对等,对美国而言,胜利将无悬念,但代价却可能非常大。美国的决策者对此十分谨慎,不可能甘冒这样的战略风险。笔者以为,针对此次朝鲜核试验,特朗普最重要的对应,还是勒令中国切断对朝鲜的石油供应。


面对朝鲜已经实现热核武器实战化的现实,窃以为,中国最好别没事引火烧身,还是看好自己的门,管好自己的人。须知,核力量是金三胖的命根子,谁挑战,他就要同谁死磕.
Viewing all 20452 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>