1. Список говнокодов пользователя GoUseGitHub

    Всего: 2

  2. Куча / Говнокод #18539

    +999

    1. 1
    ++++++++++++++++++++----------+++++++++++++++--+-+++-.

    Брейнфак можно обфусцировать! Но зачем?

    GoUseGitHub, 27 Июля 2015

    Комментарии (9)
  3. Python / Говнокод #17792

    −115

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    98. 98
    def _message_handler_thread(self):
            self._nick_change_failed = []
            while self.running:
                msg = self._message_queue.get(True)
                text = msg.get_data()
                conn = msg.get_connection()
                args = text.replace("\r", "").replace("\n", "").split(" ")
                command = args[0].upper()
                command_args = args[1:]
                if command == "NICK":
                    if len(command_args) < 1:
                        self._send_not_enough_parameters(conn, command)
                    else:
                        ident = self._clients[conn].identifier if self._clients[conn].identifier else None
                        if not self._set_nick(conn, command_args[0], ident):
                            self._nick_change_failed.append(conn)
                elif command == "USER":
                    if conn in self._clients:
                        if len(command_args) < 2:
                            self._send_not_enough_parameters(conn, command)
                        else:
                            ''''
                            self._send_lusers(conn)
                            self._clients[conn].real_name = command_args[:]
                            self._clients[conn].identifier = self._clients[conn].get_nick() + "!" + \
                                                                   command_args[0] + "@" + self.name
                            '''
                            self._set_nick(conn, command_args[0], command_args[1])
                            self._send_motd(conn)
                    else:  # Another way to identify is USER command.
                        if len(command_args) < 2:
                            self._send_not_enough_parameters(conn, command)
                        elif conn in self._nick_change_failed:
                            self._nick_change_failed.remove(conn)
                        else:
                            if self._set_nick(conn, command_args[0], command_args[1]):
                                self._clients[conn].identifier = self._clients[conn].get_nick() + "!" + \
                                    command_args[0] + "@" + self.name
                                self._send_motd(conn)
                elif command == "PRIVMSG" or command == "NOTICE":
                    if len(command_args) < 2:
                        self._send_not_enough_parameters(conn, command)
                    else:
                        message_text = command_args[1] if not command_args[1][0] == ":" else \
                            text.replace("\r\n", "")[text.index(":")+1:]
                        src = self._clients[conn].get_identifier()
                        dest = command_args[0]
                        if not dest.startswith("#"):
                            for clnt in self._clients.values():
                                if clnt.nick == dest:
                                    clnt.connection.send(
                                        ":%s %s %s :%s" % (src, command, dest, message_text)
                                    )
                                    break
                            else:
                                self._send_no_user(conn, dest)
                        else:
                            for chan in self._channels:
                                if chan.name == dest:
                                    self._channel_broadcast(conn, chan, ":%s %s %s :%s" %
                                                (src, command, dest, message_text))
                                    break
                            else:
                                self._send_no_user(conn, dest)
                elif command == "JOIN":
                    if len(command_args) < 1:
                        self._send_not_enough_parameters(conn, command)
                    elif not all(c in ALLOWED_CHANNEL for c in command_args[0]) and len(command_args[0]):
                        self._send_no_channel(conn, command_args[0])
                    else:
                        for chan in self._channels:
                            if chan.name == command_args[0]:
                                chan.users += 1
                                self._clients[conn].channels.append(chan)
                                self._send_to_related(conn, ":%s JOIN %s" % (self._clients[conn].get_identifier(),
                                                                             chan.name), True)
                                self._send_topic(conn, chan)
                                self._send_names(conn, chan)
                        else:
                            chan = Channel(command_args[0], 1)
                            chan.users = 1  # We have a user, because we have created it!
                            self._channels.append(chan)
                            self._clients[conn].channels.append(chan)
                            self._clients[conn].send(":%s JOIN %s" % (self._clients[conn].get_identifier(),
                                                       command_args[0]))
                elif command == "PART":
                    if len(command_args) < 1:
                        self._send_not_enough_parameters(conn, command)
                    else:
                        for chan in self._channels:
                            if chan.name == command_args[0]:
    
                                self._send_to_related(conn, ":%s PART %s" % (self._clients[conn].get_identifier(),
                                                                             command_args[0]))
                                self._clients[conn].channels.remove(chan)
                                chan.users -= 1
                                break
    ...

    Я писал сервер для IRC...
    Больше говнокода: https://github.com/SopaXorzTaker/irc-server/

    GoUseGitHub, 15 Марта 2015

    Комментарии (58)