Skip to content

Instantly share code, notes, and snippets.

View volker48's full-sized avatar
💭
🚀

Marcus McCurdy volker48

💭
🚀
View GitHub Profile

Keybase proof

I hereby claim:

  • I am volker48 on github.
  • I am marcusmccurdy (https://keybase.io/marcusmccurdy) on keybase.
  • I have a public key whose fingerprint is E3B1 C64D 9433 6BEC 7F0C 4139 7369 B29E 7655 B659

To claim this, I am signing this object:

@Override
public void focusLost(FocusEvent e) {
final String textOnExit = textArea.getText();
if (textOnEntry.equals(textOnExit)) {
return;
}
content.saveNewVersion(textOnExit);
}
#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:
..............ttttt..........
.............................
t......ttt................ttt
....tt....tt.................
..................ttt...ttttt
wwwwwwwwwwwwtttttt.....tttwww
.........ttttttt.............
t............................
wwwwwwwwwwwwttttttttt........
.............wwwwwwwwwwwwwwww
@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..........................................................................................
@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: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: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 / 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: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()));