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
local socket = require("socket.core") | |
local json = require("json") | |
function connect(address, port, laddress, lport) | |
local sock, err = socket.tcp() | |
if not sock then return nil, err end | |
if laddress then | |
local res, err = sock:bind(laddress, lport, -1) | |
if not res then return nil, err end | |
end |
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
#python 2.7 | |
import os, glob, shutil, zipfile, path | |
def applyToAllFilesInFolder ( folder, fileexts, func, *params): | |
"""apply function with params func to all files with extenstions from list fileext in folder | |
example: | |
applyToAllFilesInFolder ("C:", [".txt"], lambda filename:None) | |
""" | |
def visit ( arg, dirname, names ): |
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
Config: Settings_Tmnt-1.cs | |
palAddr 0xcd51 == 0xcd51 | |
screensOffset 0x4e79 == 0x4e79 | |
palOffset 0x70e9 == 0x70e9 | |
blocksOffset 0xc011 == 0xc011 | |
Config: Settings_Tmnt-2-1.cs | |
palAddr 0xdd25 == 0xdd25 | |
screensOffset 0x5239 == 0x5239 | |
palOffset 0x1f851 != 0x1f843 | |
blocksOffset 0xce25 == 0xce25 |
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
import milight | |
controller = milight.MiLight({'host': MILIGHT_ROUTER_ADDRESS, 'port': 8899}, wait_duration=0) | |
light = milight.LightBulb(['rgbw']) #Lamp type | |
controller.send(light.all_on()) #Turn on all lights |
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
from pybitcoin import BitcoinPrivateKey, BitcoinPublicKey | |
import hashlib | |
pk = hashlib.sha256("satoshi nakamoto") | |
print pk.hexdigest() | |
privateKey = BitcoinPrivateKey(pk, False) | |
publicKey = privateKey.public_key() | |
a1 = publicKey.address() | |
print(a1) |
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
from autobahn.twisted.wamp import ApplicationRunner | |
from os import environ | |
class MyBackend(ApplicationSession): | |
#code of backend skipped | |
runner = ApplicationRunner( | |
environ.get("AUTOBAHN_DEMO_ROUTER", u"wss://example.com:8080/ws"), | |
u"realm1", |
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
606 , Patching , Not Applicable , Indep , N/A , NUPS , Nintenlord , 365969 , | |
598 , Patching , Not Applicable , Win , N/A , xdelta UI , KaioShin , 329149 , | |
661 , Miscellaneous Graphics Tools , PlayStation 2 , Win , N/A , Tim2bmp Converter Tool , gnie , 278565 , | |
519 , Patching , Not Applicable , Indep , N/A , Tsukuyomi UPS , byuu , 265062 , | |
356 , Patching , Not Applicable , Win , N/A , PPF-O-Matic , Paradox , 176273 , | |
362 , Graphics Viewers , Game Boy Advance , Win , N/A , unLZ-GBA , loadingNOW , 166804 , | |
704 , Patching , Not Applicable , Win , N/A , Delta Patcher , SadNES cITy Translations , 140272 , | |
893 , Patching , Not Applicable , Indep , N/A , beat , byuu , 99356 , | |
458 , Level Editors , PC , Win , Cave Story , Miza , Kyoufu Kawa , 63201 , | |
818 , Graphics Editors , Multi-Platform , Win , N/A , Crystal Tile 2 , angel-team , 61428 , |
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
from find_blocks import * | |
start2x2hMacro = (0,1,16,17) | |
MACROBLOCKS_SIZE = NAME_TABLE_SIZE / 4 | |
#считывание данных о блоках 1-го уровня, расположенных в SoA-формате | |
def grouper(n, iterable, padvalue=None): | |
"grouper(3, 'abcdefg', 'x') --> ('a','b','c'), ('d','e','f'), ('g','x','x')" | |
return list(izip_longest(*[iter(iterable)]*n, fillvalue=padvalue)) | |
def readFromAlignedArrays(romdata, addrs, blocksCount): |
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
import re | |
def findBlocksInRom(blocks, romData): | |
#инициализация массива найденных индексов | |
blockFound = [-1,]*len(romData) | |
#ШАГ 1 Размечаем найденные в ROM блоки | |
for blockIndex, block in enumerate(blocks): | |
#экранируем символы в строке для поиска | |
blockStr = re.escape(''.join(blockStr)) | |
#отмечаем все адреса, по которым нашёлся блок | |
for m in re.finditer(blockStr, romData, re.DOTALL): |
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
from operator import itemgetter | |
NAME_TABLE_SIZE = 960 | |
def getAllScreenBlocks(tiles): | |
#функция выбора индексов блока | |
def getNextItem2x2(firstIndex, maxIndex): | |
i = firstIndex | |
while i < maxIndex: | |
for x in xrange(16): | |
yield i |