自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

原创 windows vim settings

autocmd FileType * set tabstop=2|set shiftwidth=2 |  set softtabstop=2 |set expandtab set noundofile set backupdir=c:\temp

2016-12-27 13:26:48 293 1

原创 get pid by executable image name in Linux

ps -C python -o pid --no-headers

2016-09-14 09:42:16 280 0

原创 在ubuntu上通过SSH tunnel 安装软件

场景有一台可以访问(出站)因特网主机A,对外开放SSH(入站)。主机B运行ubuntu, 没有因特网访问权限,但是可以ssh到主机A。问题apt-get 更新主机B方案 在主机B的/etc/hosts中加上 127.0.0.1 your_mirror_server sudo ssh -NCf -...

2015-10-23 18:12:57 707 0

原创 加速stackoverflow.com加载速度

发现stackoverflow.com在国内加载很慢, 分析了一下: 在缓慢尝试从谷歌的CDN中加载jquery。 解决办法: 修改dns/或hosts文件,让它从本地加载。 本地可以没有web服务器, 这样可以让更快的失败。 //C:\Windows\System32\drive...

2015-08-18 23:28:30 1134 0

原创 在windows上部署freesshd

1. 下载安装。根据向导点击下一步就可以完成。 2. 以管理员权限运行freessd. (不是以管理员账户运行哦) 3. Settings->user-> add a new user 4. unload 5.以管理员权限运行freessd 

2015-07-24 10:31:37 578 0

原创 ubuntu firefox flashplugin

1. get flashplugin tar.gz file from adobe website 2. untar it 3.    cp libflashplayer.so /usr/lib/firefox/browser/plugins/  cp -r ./usr/...

2015-06-12 08:54:15 253 0

原创 ubuntu 中文字体安装

sudo apt-get install xfonts-wqy

2015-06-12 08:42:36 369 0

原创 让安卓手机显示彝文

1.没有安装彝文字, 打开yi.people.com.cn, 显示乱码 2. 获得手机root权限,我这里是用的是“百度一键root". 傻瓜式操作, 很容易。 3. 安装“授权管理”, 这有可以对个别程序root授权。 4. 安装"ES"...

2015-04-23 21:04:11 931 0

原创 通过SSH Tunnel远程操作防火墙内的主机

准备: 防火墙内的主机A, 位于公网的跳转主机ubuntu B(b.b.b.b), 任意可操作的电脑C配置主机B 参考这里 sshd(服务器)和ssh(客户端):sshd在b.b.b.b:22监听vnc server 和vnc viewwer: vnc server在127.0.0.1:590...

2015-04-08 11:38:20 379 0

原创 workaround for ubuntu 14.04 team viewer not ready issue

please use the one Other systems (not officially supported)

2015-04-08 09:56:35 475 0

原创 通过vnc viewer连接64位ubuntu 14.02 LTS 云主机上

前提条件:已经申请了64位ubuntu 14.02 LTS的云主机切换到root账户,以后就不用sudo了 sudo bash安装图形桌面 apt-get install ubuntu-desktop -y安装gnome apt-get install gnome安装vnc server apt-...

2015-04-08 09:36:59 859 0

原创 RAII用例:让C++ IO流的fmtflag自动重置

C的FILE流中,格式化控制仅影响当前IO操作。

2014-09-14 19:16:05 866 0

原创 a calendar utility

#include #include #include typedef struct date_s date_t; struct date_s { int serial; }; #define is_leap(y) (((y) % 400 == 0)||((0 == (y)%4) &...

2014-09-10 14:33:43 420 0

原创 visual c++ 操作UTF-8

微软的C/C++ CRT不支持UTF-8的locale,

2014-08-23 15:07:12 864 0

原创 paste utilitiy -- merge lines of files

#include #include #include #include #include #define SEP "\t" class Line; std::istream& operator >> (std::istream& is,...

2014-05-20 21:51:06 483 0

原创 using tail recursion to reverse words of line ( just for fun)

#include #include #include #include class Solution { public: void reverseWords(std::string &s){ std::reverse(s.begin(), s.end()); ...

2014-04-25 10:46:52 747 0

原创 type dedution and reference collapse in c++ 11(works vc++ 2013)

#include #include #include template struct Ident { static char const* name() { return "T"; } }; template struct Ident { static ...

2014-04-24 08:09:55 773 0

原创 a simple event loop with IOCP

Windows IOCP provides a way to scalable and high performance Input/Output. It also gives an  easier way to make a event loop or message passing syste...

2014-04-03 12:48:42 1045 0

原创 using lamda to make RAII idom

#define _CRT_SECURE_NO_WARNINGS #include #include #include template class scoped_object { public: scoped_object(ctor c, dtor d): t_(c()), d...

2014-04-02 08:38:01 433 0

原创 convert Structured Exception Code to string

#include #include // for EXCEPTION_ACCESS_VIOLATION #include char const* exCode2ExDesc(unsigned int exCode) { switch (exCode) { case EXCEPTION...

2013-12-02 21:29:19 706 0

原创 C++ file stream open mode vs C file stream open mode in Visual C++ 2013

//C++ file stream valid stream open mode ios_base::openmode mode; { static const int valid[] = { // valid combinations of open flags ios_bas...

2013-11-03 10:56:47 1068 0

原创 how vc convert LR LF to LR

//read.c if (_osfile(fh) & FTEXT) { /* now must translate CR-LFs to LFs in the buffer */ /* For ANSI & UTF8, we ...

2013-11-02 20:19:36 746 0

原创 read a line with arbitrary length using fgets

let me know if you found any issue via bruceadi(at)hotmail.com, thanks#include #include #include char* getline(char** pbuf, size_t* buflen, FILE*...

2013-08-15 10:38:34 641 0

原创 capture windows/screen using GDI+

It's just a demo to show GDI+ usage, just for fun #ifndef UNICODE #define UINICODE #endif #include #include #include #include //using nam...

2013-08-09 01:48:05 1326 0

原创 use python to download files from http servers

I am preparing for a visit to a US firm in NY rencently. I reallyized It sounds a good idea to have some business english audio. Google tells me ther...

2013-07-25 21:07:20 607 0

原创 demo for insert values into sorted single list

#include #include #include extern "C" { typedef struct node_s node_t; struct node_s { int value; node_t* next; }; v...

2013-04-23 00:18:22 781 0

原创 a utility to compare date diff and date advance^_^

#include typedef struct date_s date_t; struct date_s { int serial; }; #define is_leap(y) (((y) % 400 == 0)||((0 == (y)%4) && (0 != (y) ...

2013-04-18 14:03:49 717 0

原创 how to extend C style IO to user defined types

the other day, we had to extend C style IO to use defined types. Let the code says how we made that work #include #include #include #include #inc...

2013-03-26 14:43:51 615 0

原创 integer addition in terms of bit operators, just for fun

#define SIZE_OF_INT 4 #if SIZE_OF_INT == 4 int add(unsigned int a, unsigned int b) { //implement integer addition with bit operators, just for fu...

2013-03-26 10:37:27 511 0

原创 C++ code to verify IEEE 754 double precision floating-point format

As the title says, let the code talk. //feel free to use it in your project with nothing guaranteed //mail to: bruceadi(at)hotmail.com //to verit...

2013-03-10 18:43:55 962 0

原创 a utility for compressing messages to be shared among processes

Data shared among processes could be limited to integers and strings. Other types could be present with these two types. 1.     A floating value c...

2013-03-09 00:54:04 579 0

原创 a simple function for memory dumping

//feel free to use it in your project with nothing guaranteed //mail to: bruceadi(at)hotmail.com #include //assumption: // f is allowed to wr...

2013-03-08 14:38:31 749 0

原创 another lightweight c++ log utility

As we all know, logs are often helpful to pinpointing programs problems. It's nice to have a resuable log library so that we could put more effo...

2013-02-17 12:26:08 490 0

提示
确定要删除当前文章?
取消 删除