Skip to content

Instantly share code, notes, and snippets.

View volker48's full-sized avatar
💭
🚀

Marcus McCurdy volker48

💭
🚀
View GitHub Profile
@volker48
volker48 / gist:2879393
Created June 6, 2012 02:01
skeehd oath?
Host: app.plusplus.com
User-Agent: Skee-Ball-HD-Free/2.5 PlusPlus/2.5.0.7 iPhone OS/5.1.1
Accept: application/binary-plist, application/json
Accept-Encoding: gzip
If-None-Match:
Authoriza
@volker48
volker48 / gist:2870621
Created June 4, 2012 20:19
SSL MITM proxy error
code/cs645-hg/project4% ./run.sh
make: Nothing to be done for `target'.
Initializing SSL proxy with the parameters:
Local host: localhost
Local port: 8001
Admin port: 8002
(SSL setup could take a few seconds)
Proxy initialized, listening on port 8001
Admin server initialized, listening on port 8002
Starting MITM Proxy Server.
@volker48
volker48 / gist:2853610
Created June 1, 2012 17:00
PBKDF2 Java sample
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
KeySpec keyspec = new PBEKeySpec("password".toCharArray(), salt, 1000, 128);
Key key = factory.generateSecret(keyspec);
System.out.println(key.getClass().getName());
System.out.println(Arrays.toString(key.getEncoded()));
@volker48
volker48 / units
Created March 11, 2012 22:29
unit dimensions
int unitLeft = unit.getPosition().getX() - unitInfo.getDimensionLeft() - 8;
int unitRight = unit.getPosition().getX() + unitInfo.getDimensionRight() + 8;
int unitTop = unit.getPosition().getY() - unitInfo.getDimensionUp() - 8;
int unitBottom = unit.getPosition().getY() + unitInfo.getDimensionDown() + 8;
@volker48
volker48 / gist:2017714
Created March 11, 2012 19:12
TBA* diff
@@ -132,8 +132,9 @@
while (OPEN != null && OPEN.size() > 0) {
cycleCount++;
Node current = OPEN.remove();
+ openSet.remove(current.getTile());
- // If this is the end node, we are done searching
+ // If this is the end node or we ran out of cycles
if (current.getTile().equals(endNode.getTile()) || cycles == 0) {
if (current.getTile().equals(endNode.getTile())) {
@volker48
volker48 / gist:2017702
Created March 11, 2012 19:08
isOnMoveTile
List<MapTile> toCheck = new ArrayList<MapTile> (Arrays.asList(tile.getSurroundingTiles()));
toCheck.add(tile);
final UnitInfo unitInfo = bwapi.getUnitInfo(unit.getType());
int unitLeft = unit.getPosition().getX() - unitInfo.getDimensionLeft()-16;
int unitRight = unit.getPosition().getX() + unitInfo.getDimensionRight()+16;
int unitTop = unit.getPosition().getY() - unitInfo.getDimensionUp()-16;
int unitBottom = unit.getPosition().getY() + unitInfo.getDimensionDown()+16;
for (MapTile mt : toCheck) {
int tileLeft = mt.getX()*8;
@volker48
volker48 / gist:2007435
Created March 9, 2012 16:45
getNeighbors
public Collection<Node> getNeighbors() {
final List<Node> neighbors = new ArrayList<Node>();
int x = this.coord.x;
int y = this.coord.y;
Coord[] coords = new Coord[8];
coords[0] = new Coord(x - 1, y - 1);
coords[1] = new Coord(x, y - 1);
coords[2] = new Coord(x + 1, y - 1);
coords[3] = new Coord(x + 1, y);
coords[4] = new Coord(x + 1, y + 1);
@volker48
volker48 / gist:2007054
Created March 9, 2012 15:36
A* working
...xxxx....................................................................................xxxxxxxxxx...................................................................................xxxxxxxxxxxxxxxxxx.................xxxxxxxx.....xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx............................................................................................................xxxxxxxxxxxxxxxxxx.........................................................................................
.xxxxxx........................................................................................xxxxxxxxx..................................................................................xxxxxxxxxxxxxxxxx.x..................xxxxxx...xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.......................................................................................................xxxxxxxxxxxxxxxxxxx..........................................................................................
..............ttttt..........
.............................
t......ttt................ttt
....tt....tt.................
..................ttt...ttttt
wwwwwwwwwwwwtttttt.....tttwww
.........ttttttt.............
t............................
wwwwwwwwwwwwttttttttt........
.............wwwwwwwwwwwwwwww
#list comprehension to evaluate each item in the list
if not self:
return List([])
else:
lis = [item.eval(variables, functions) for item in self]
#elem = lis.pop()
lis.reverse()
cell = -1
#cell = BuiltinCall.cons([],elem)
for x in lis: