- 博客(34)
- 资源 (3)
- 收藏
- 关注
原创 nginx + php-fpm + phpMyAdmin + mysql
OS: centos X86_64 6.9upgrade systemyum updateyum upgradesetup mysql-serveryum install mysql-serverservice mysqld start#set root password, disable root remote login, remove test database,etc/usr/bin/mysql_secure_installation#disable tcp/ip connect
2020-10-12 15:34:07
179
原创 windows vim settings
autocmd FileType * set tabstop=2|set shiftwidth=2 | set softtabstop=2 |set expandtabset noundofileset backupdir=c:\temp
2016-12-27 13:26:48
430
1
原创 get pid by executable image name in Linux
ps -C python -o pid --no-headers
2016-09-14 09:42:16
400
原创 在ubuntu上通过SSH tunnel 安装软件
场景有一台可以访问(出站)因特网主机A,对外开放SSH(入站)。主机B运行ubuntu, 没有因特网访问权限,但是可以ssh到主机A。问题apt-get 更新主机B方案在主机B的/etc/hosts中加上 127.0.0.1 your_mirror_serversudo ssh -NCf -L 80:your_mirror_server:80 user_name@host_Asudo apt
2015-10-23 18:12:57
1036
原创 加速stackoverflow.com加载速度
发现stackoverflow.com在国内加载很慢, 分析了一下: 在缓慢尝试从谷歌的CDN中加载jquery。 解决办法: 修改dns/或hosts文件,让它从本地加载。 本地可以没有web服务器, 这样可以让更快的失败。 //C:\Windows\System32\drivers\etc\hosts127.0.0.1 ajax.googleapis.com
2015-08-18 23:28:30
1501
原创 在windows上部署freesshd
1. 下载安装。根据向导点击下一步就可以完成。 2. 以管理员权限运行freessd. (不是以管理员账户运行哦)3. Settings->user-> add a new user4. unload5.以管理员权限运行freessd
2015-07-24 10:31:37
841
原创 ubuntu firefox flashplugin
1. get flashplugin tar.gz file from adobe website2. untar it 3. cp libflashplayer.so /usr/lib/firefox/browser/plugins/ cp -r ./usr/* /usr/
2015-06-12 08:54:15
353
原创 让安卓手机显示彝文
1.没有安装彝文字, 打开yi.people.com.cn, 显示乱码2. 获得手机root权限,我这里是用的是“百度一键root". 傻瓜式操作, 很容易。 3. 安装“授权管理”, 这有可以对个别程序root授权。4. 安装"ES"文件浏览器,并启用root工具箱。5. 下载 Nu
2015-04-23 21:04:11
1428
原创 通过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:5900监听配置主机Asshd和ssh: sshd在 127.0.0.1:22j监听vnc
2015-04-08 11:38:20
525
原创 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
580
原创 通过vnc viewer连接64位ubuntu 14.02 LTS 云主机上
前提条件:已经申请了64位ubuntu 14.02 LTS的云主机切换到root账户,以后就不用sudo了 sudo bash安装图形桌面 apt-get install ubuntu-desktop -y安装gnomeapt-get install gnome安装vnc server apt-get install vnc4server启动vnc server已生成配置文件和密码 vncse
2015-04-08 09:36:59
1048
原创 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) && (0 != (y) % 100)))int year_days[2] = {365, 366}
2014-09-10 14:33:43
548
原创 paste utilitiy -- merge lines of files
#include #include #include #include #include #define SEP "\t"class Line;std::istream& operator >> (std::istream& is, Line & line);std::ostream& operator << (std::ostream& os, Line const & li
2014-05-20 21:51:06
628
原创 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()); std::istringstream iss(s); s = ""; std::s
2014-04-25 10:46:52
859
原创 type dedution and reference collapse in c++ 11(works vc++ 2013)
#include #include #include templatestruct Ident{ static char const* name() { return "T"; }};templatestruct Ident{ static char const* name() { return "T const"; }};templatestr
2014-04-24 08:09:55
895
原创 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 system, take a look of the demo bellow.#include
2014-04-03 12:48:42
1216
原创 using lamda to make RAII idom
#define _CRT_SECURE_NO_WARNINGS#include #include #include templateclass scoped_object{ public: scoped_object(ctor c, dtor d): t_(c()), dtor_(d){} ~scoped_object() { dtor_(t_
2014-04-02 08:38:01
532
原创 convert Structured Exception Code to string
#include #include // for EXCEPTION_ACCESS_VIOLATION#include char const* exCode2ExDesc(unsigned int exCode){ switch (exCode) { case EXCEPTION_ACCESS_VIOLATION: return "EXCEPTION_ACCESS_VIOLA
2013-12-02 21:29:19
774
原创 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_base::in, ios_base::out, ios_base::out | ios_base:
2013-11-03 10:56:47
1203
原创 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 read byte by byte. For UTF16, we need to rea
2013-11-02 20:19:36
872
原创 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* stream){ if(*buflen <= 1) return NULL; if(!fge
2013-08-15 10:38:34
801
原创 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 namespace Gdiplus;#pragma comment (lib,"Gdiplus.lib")int
2013-08-09 01:48:05
1575
原创 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 there are quite a lot of available now. But I have to d
2013-07-25 21:07:20
703
原创 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; }; void destroy(node_t* head) { node_t *p, *n = head; w
2013-04-23 00:18:22
865
原创 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) % 100)))int year_days[2] = {365, 366};unsigned char mont
2013-04-18 14:03:49
844
原创 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 #include typedef struct tagProcessor{ char name[32
2013-03-26 14:43:51
695
原创 integer addition in terms of bit operators, just for fun
#define SIZE_OF_INT 4#if SIZE_OF_INT == 4int add(unsigned int a, unsigned int b){ //implement integer addition with bit operators, just for fun unsigned int c = 0, result = 0; //the looking
2013-03-26 10:37:27
630
原创 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 verity Double-precision floating-point format, see the l
2013-03-10 18:43:55
1147
原创 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 could be presented in the form of mantissa and expon
2013-03-09 00:54:04
652
原创 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 write,// memory block [bytes, bytes+ len) is a acc
2013-03-08 14:38:31
852
原创 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 effort to much nicer things. /*comments are welcome via
2013-02-17 12:26:08
605
cppCon 2014 ppt 第三部分
2015-01-04
cppCon 2014 ppt 第二部分
2015-01-04
cppCon 2014 ppt 第一部分
2015-01-04
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人