This file contains 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
class Data(dict): | |
def __init__(self, *args, **kwargs): | |
super(Data, self).__init__(*args, **kwargs) | |
self.__dict__ = self |
This file contains 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
flatten = lambda lst: reduce(lambda l,i: l + flatten(i) if isinstance(i, (list,tuple)) else l + [i], lst, []) | |
print flatten([2, [2, [4, 5, [7], [2, [6, 2, 6, [6], 4]], 6]]]) | |
# -> [2, 2, 4, 5, 7, 2, 6, 2, 6, 6, 4, 6] |
This file contains 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 -*- | |
import operator | |
import itertools | |
import re | |
def debug(x): | |
print 'debug', dir(x), x.group() |
This file contains 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 -*- | |
# FileName : cstruct.py | |
# Author : Feather.et.ELF <andelf@gmail.com> | |
# Created : Tue Feb 28 23:06:44 2012 by Feather.et.ELF | |
# Copyright : Feather Workshop (c) 2012 | |
# Description : mcpack v1 v2 | |
# Time-stamp: <2012-03-31 18:58:42 andelf> | |
import struct |
This file contains 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
package main | |
import ( | |
"log" | |
"net/mail" | |
"encoding/base64" | |
"net/smtp" | |
"fmt" | |
"strings" |
This file contains 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
// MIT license (c) andelf 2013 | |
import ( | |
"net/smtp" | |
"errors" | |
) | |
type loginAuth struct { | |
username, password string |
This file contains 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 escript | |
% -*- mode: erlang -*- | |
main([BeamFile]) -> | |
{ok,{_,[{abstract_code,{_,AC}}]}} = beam_lib:chunks(BeamFile,[abstract_code]), | |
io:fwrite("~s~n", [erl_prettypr:format(erl_syntax:form_list(AC))]). |
This file contains 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
#设置终端颜色为256色 | |
set -g default-terminal "screen-256color" | |
# auto resize to smallest windows size | |
setw -g aggressive-resize on | |
# Terminal emulator window titles | |
set -g set-titles on | |
set -g set-titles-string "#T" | |
#将激活控制台的快捷键由Ctrl+b修改为Ctrl+z |
This file contains 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
%%%------------------------------------------------------------------- | |
%%% @author <andelf@gmail.com> | |
%%% @copyright (C) 2013, | |
%%% @doc | |
%%% | |
%%% @end | |
%%% Created : 18 Apr 2013 by <andelf@gmail.com> | |
%%%------------------------------------------------------------------- | |
-module(dns_proxy_srv). |
OlderNewer