This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var url = 'https://static.mawenbao.com/images/cartoon/%E7%BB%88%E6%9C%AB%E7%9A%84%E4%BC%8A%E6%B3%BD%E5%A1%94.jpg'; | |
| var xhr = new XMLHttpRequest(); | |
| xhr.open('GET', url, false); | |
| if (xhr.overrideMimeType) xhr.overrideMimeType('text/plain; charset=x-user-defined'); | |
| xhr.setRequestHeader("Content-Type", "application/octet-stream"); | |
| var txt = ''; | |
| function handle() { | |
| if (this.readyState != null && (this.readyState < 3 || this.status != 200)) { | |
| return |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: UTF-8 -*- | |
| # @author: mawenbao@hotmail.com | |
| # @date: 2014-09-03 | |
| ''' | |
| 将两个libmmseg中文词典合并为一个。 | |
| ''' | |
| import argparse |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int foo2(int a, long b, int c, int d, int e, int f, int g, int i) { | |
| push %rbp // 将caller的%rbp入栈 | |
| mov %rsp,%rbp // 初始化callee的%rbp | |
| mov %edi,-0x4(%rbp) // a: mem[R[rbp]-0x4] = R[edi] | |
| // 暂存寄存器的值,使其可以被重用,使用-O选项可以优化掉这部分代码 | |
| mov %rsi,-0x10(%rbp) // b | |
| mov %edx,-0x8(%rbp) // c | |
| mov %ecx,-0x14(%rbp) // d | |
| mov %r8d,-0x18(%rbp) // e | |
| mov %r9d,-0x1c(%rbp) // f |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int foo2(int a, long b, int c, int d, int e, int f, int g, int i) { | |
| return a + b; | |
| } | |
| int foo(int &a, long b) { | |
| int m = 1; | |
| int o[3] = {0x1, 0x2, 0x3}; | |
| return foo2(0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x9); | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: UTF-8 -*- | |
| # @author: mawenbao@hotmail.com | |
| # @date: 2014.04.25 | |
| # @desc: parse backtrace output | |
| import re | |
| import os | |
| import sys | |
| import subprocess |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <execinfo.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| #include <signal.h> | |
| void print_stack_frames(int signum) { | |
| int j, nptrs; | |
| #define SIZE 100 | |
| void *buffer[100]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Makefile for gtest examples | |
| GOOGLE_TEST_LIB = gtest | |
| GOOGLE_TEST_INCLUDE = /usr/local/include | |
| G++ = g++ | |
| G++_FLAGS = -c -Wall -I $(GOOGLE_TEST_INCLUDE) | |
| LD_FLAGS = -L /usr/local/lib -l $(GOOGLE_TEST_LIB) -l pthread | |
| OBJECTS = main.o string-compare.o |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- # | |
| from __future__ import unicode_literals | |
| import datetime | |
| AUTHOR = u'Ma Wenbao' | |
| SITENAME = u'MWB日常笔记' | |
| SITEURL = 'http://blog.atime.me' | |
| #SITEURL = 'http://localhost:8000' |