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
to_mem = True # set to False if you want a actual zip file of the delta made (e.g. you want to recompress it with 7z) | |
import zipfile | |
import sys, os, cStringIO | |
if len(sys.argv) != 3: | |
print "Diffs a zip file against a folder, and computes a file-granularity delta" | |
print "usage: python diff1.py prev.zip newfolder" | |
print "e.g. is MRise_1.0.zip is in your current directory, and you have the 1.6 directory tree in a folder called MRise_1.6, then:" | |
print " python diff1.py MRise_1.0.zip MRise_1.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
import os, sys, string | |
import xml.dom.minidom as minidom | |
from struct import unpack | |
from itertools import chain | |
class File: | |
"""a file (type and path)""" | |
MAP = "map" | |
SCENARIO = "scenario" |
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
=== Mod check failed === | |
(model BROKEN techs/megapack/factions/persian/units/swordman/models/guard_attacking.g3d (referenced by: unit ../swordman.xml)) ('Error reading G3D file', IOError(2, 'No such file or directory')), ('File does not exist',) | |
(model BROKEN techs/megapack/factions/tech/units/swordman/models/guard_attacking.g3d (referenced by: unit ../swordman.xml)) ('Error reading G3D file', IOError(2, 'No such file or directory')), ('File does not exist',) | |
(model BROKEN techs/vbros_pack_1/factions/canadians/units/beaver/models/worker_standing_loaded_wood.g3d (referenced by: unit ../beaver.xml)) ('Error reading G3D file', IOError(2, 'No such file or directory')), ('File does not exist',) | |
(model BROKEN techs/vbros_pack_1/factions/canadians/units/inuit_man/models/minstrel_summoning.g3d (referenced by: unit ../inuit_man.xml)) ('Error reading G3D file', IOError(2, 'No such file or directory')), ('File does not exist',) | |
(particle BROKEN techs/megapack/factions/persian/units/worker/particle_splash.xml (referenced |
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
# glest_mod_pack is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. |
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 tornado import ioloop, web, httpserver, httpclient | |
PORT = 8080 | |
class TestHandler(web.RequestHandler): | |
@web.asynchronous | |
def get(self): | |
url = "http://www.google.com" | |
print "fetching",url |
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 | |
import sys, datetime, subprocess | |
churn = {} # lines per date | |
# get a list of tracked files | |
git = subprocess.Popen(("git","ls-files"),stdout=subprocess.PIPE) | |
files = git.communicate()[0].strip().split("\n") | |
if git.returncode: sys.exit(1) |
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
<html><head><title>test.py</title> | |
<style> | |
.v { font-weight: bold; color: navy; } | |
.error { font-weight: bold; color: yellow; background-color: red; } | |
.unused { font-weight: light; color: darkgray; } | |
</style> | |
<script type="text/javascript"> | |
var highlight = {}; | |
function clear_highlight() { | |
for(var id in highlight) { |
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 java.util.Random; // for test code | |
final class BFS { | |
/* finds nearest ant to a destination in a maze. | |
You give it a (partial) map and it plots a route using naive BFS. | |
As you discover more obstacles you can call addWater() for them. | |
It makes extensive use of pre-allocated data for intermediate results, | |
so you must extract the path for each call to findNearestAnt() or you | |
lose it. */ | |
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
<html> | |
<head> | |
<script type="text/javascript"> | |
<!-- | |
function onkey(event) { | |
if(event.target.id == "b") { | |
var c = document.getElementById("c"); | |
if(!c) { | |
document.getElementById("a").innerHTML += "<br/><input id=\"c\" type=\"text\"/>"; | |
c = document.getElementById("c"); |
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 array | |
# these routines copied shamelessly from http://threeblindmiceandamonkey.com/?p=16 | |
# multiply matrix: c = a * b | |
cdef inline void multiplyMatrix(double a[3][3], double b[3][3], double c[3][3]): | |
c[0][0] = a[0][0]*b[0][0] + a[0][1]*b[1][0] + a[0][2]*b[2][0] | |
c[0][1] = a[0][0]*b[0][1] + a[0][1]*b[1][1] + a[0][2]*b[2][1] | |
c[0][2] = a[0][0]*b[0][2] + a[0][1]*b[1][2] + a[0][2]*b[2][2] | |
c[1][0] = a[1][0]*b[0][0] + a[1][1]*b[1][0] + a[1][2]*b[2][0] |
OlderNewer