Skip to content

Instantly share code, notes, and snippets.

@talebook
talebook / cdn-dispatch-log-jobs.py
Created May 7, 2019 07:13
cdn-dispatch-log-jobs.py
#!/usr/bin/python
#-*- coding: UTF-8 -*-
import re
import os
import sys
import json
import requests
import urlparse
import logging
@talebook
talebook / cdn-save-log-into-cos.py
Last active May 7, 2019 07:09
cdn-save-log-into-cos
#!/usr/bin/python
#-*- coding: UTF-8 -*-
import os
import re
import sys
import json
import requests
import urlparse
import logging
#!/usr/bin/python
'''
From gdb 7 onwards, gdb's build can be configured --with-python, allowing gdb
to be extended with Python code e.g. for library-specific data visualizations,
such as for the C++ STL types. Documentation on this API can be seen at:
http://sourceware.org/gdb/current/onlinedocs/gdb/Python-API.html
This python module deals with the case when the process being debugged (the
"inferior process" in gdb parlance) is itself python, or more specifically,
@talebook
talebook / gist:c5444cd55acc93ebd847
Created August 5, 2014 05:00
删除kindle里的个人文档
objs = jQuery(".evenhide, .oddhide");
for ( var i = 0; i < objs.length; ++ i ) {
t = objs[i];
n = "deleteItem_" + t.getAttribute("asin");
Fion.deleteItem( n );
}
@talebook
talebook / poll_connection_refused.cpp
Created March 20, 2014 11:24
完整示例代码,研究连接失败时poll()的返回值。
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <unistd.h>
#include <poll.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
int connection_refused()
{
int sockfd = async_net("127.0.0.1", 11111);
struct pollfd pfd;
pfd.fd = sockfd;
pfd.events = POLLIN|POLLOUT;
int ready = poll(&pfd, 1, -1);
printf("ready=%d, POLLIN=%d, POLLOUT=%d, POLLERR=%d\n",
ready,
( pfd.revents&POLLIN ) != 0,