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
    
  
  
    
  | $RECYCLE.BIN | |
| $Recycle.Bin | |
| .AppleDB | |
| .AppleDesktop | |
| .AppleDouble | |
| .com.apple.timemachine.supported | |
| .dbfseventsd | |
| .DocumentRevisions-V100* | |
| .DS_Store | |
| .fseventsd | 
  
    
      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
    
  
  
    
  | def round(n, m): | |
| return ((n+(m-1)) / m) * m | |
| for x in xrange(0,50): | |
| print x, "=>", round(x, 10) | |
  
    
      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
    
  
  
    
  | def MakeDirectory(path): | |
| try: | |
| os.makedirs(path) | |
| except OSError, e: | |
| if e.errno == 17: #already exist | |
| pass | |
| else: | |
| print e | |
| raise e; | 
  
    
      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
    
  
  
    
  | // Taken from http://www.codeproject.com/Articles/10500/Converting-C-enums-to-strings | |
| // File name: "EnumToString.h" | |
| #undef DECL_ENUM_ELEMENT | |
| #undef BEGIN_ENUM | |
| #undef END_ENUM | |
| #ifndef GENERATE_ENUM_STRINGS | |
| #define DECL_ENUM_ELEMENT( element ) element | |
| #define BEGIN_ENUM( ENUM_NAME ) typedef enum tag##ENUM_NAME | 
  
    
      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
    
  
  
    
  | #define BIT_SET(variable, flag) (variable) |= (flag) | |
| #define BIT_TEST(variable, flag) (((variable) & (flag)) == (flag)) | |
| #define BIT_REMOVE(variable, flag) ((variable &= ~(flag))) | 
  
    
      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
    
  
  
    
  | // double macro expansion to make int to const string | |
| // usage, printf("number of lines in this file " MAKE_STRING(42)); | |
| #define S(x) #x | |
| #define MAKE_STRING(x) S(x) | |
| #define STR__LINE__ MAKE_STRING(__LINE__) // __LINE__ as a string | 
  
    
      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
    
  
  
    
  | #taken from http://stackoverflow.com/questions/36932/how-can-i-represent-an-enum-in-python | |
| def enum(**enums): | |
| return type('Enum', (), enums) | |
| # which is used like so: | |
| # | |
| #>>> Numbers = enum(ONE=1, TWO=2, THREE='three') | |
| #>>> Numbers.ONE | |
| #1 | |
| #>>> Numbers.TWO | 
  
    
      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
    
  
  
    
  | class BGM(object): | |
| def __init__(self, _enum, _filename, _loop): | |
| self.enum = _enum; | |
| self.filename = _filename; | |
| self.loop = _loop; | |
| def __repr__(self): | |
| return self.__str__() | |
| def __str__(self): | 
  
    
      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
    
  
  
    
  | #change to the directory where the script resides | |
| os.chdir(os.path.dirname(os.path.abspath(__file__))); |