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
| char *enc_varint(char *dest, uint32_t source) { | |
| for(; source >= 0x80; dest++, source >>= 7) { | |
| *dest = 0x80 | (source & 0x7F); | |
| } | |
| *dest = source & 0x7F; | |
| return ++dest; | |
| } | |
| char *dec_varint(int32_t *dest, char *source) { | |
| for(; *(unsigned char *) source & 0x80; source++, *(uint32_t *) dest <<= 7) { |
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
| from spockbot.plugins.tools.event import EVENT_UNREGISTER | |
| from spockbot.plugins.base import PluginBase | |
| from spockbot.vector import Vector3 | |
| class NickelproFollow(PluginBase): | |
| requires = ( | |
| 'Chat', 'ClientInfo', 'Entities', 'Event', 'Movement', 'Interact' | |
| ) | |
| events = { |
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
| import struct | |
| def pack_varint(val): | |
| total = b'' | |
| if val < 0: | |
| val = (1<<32)+val | |
| while val>=0x80: | |
| bits = val&0x7F | |
| val >>= 7 | |
| total += struct.pack('B', (0x80|bits)) |
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
| import urllib.request as request | |
| from urllib.error import HTTPError | |
| import json | |
| class YggAuth: | |
| def __init__(self, | |
| client_token=None, | |
| access_token=None, | |
| username=None, | |
| password=None |
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
| import png | |
| import random | |
| random.seed() | |
| pixels = [[random.randint(0, 255) for i in xrange(0, 3*64)] for i in xrange(0, 32)] | |
| png.from_array(pixels, 'RGB').save('foo.png') |
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 <iomanip> | |
| #include <sstream> | |
| std::string to_hex(const void *data, const unsigned int size) { | |
| std::stringstream stream; | |
| stream << std::uppercase << std::hex; | |
| const unsigned char *bytes = static_cast<const unsigned char *>(data); | |
| for (unsigned int i = 0; i<size; ++i) { | |
| stream << std::setfill('0') << std::setw(2) << static_cast<const int>(bytes[i]) << " "; | |
| } |
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 enum(object): | |
| def __init__(self, *names): | |
| for number, name in enumerate(names): | |
| setattr(self, name, number) | |
| Example: | |
| Month = enum( | |
| "January", | |
| "Febuary", |
NewerOlder