Skip to content

Instantly share code, notes, and snippets.

View delexi's full-sized avatar

Alexander Baier delexi

View GitHub Profile
[delexi@lexi-n120 ~]$ x11trace xprop -id 0x169967b
No display name to create specified, trying :9
Got connection from unknown(local)
000:<: am lsb-first want 11:0 authorising with 'MIT-MAGIC-COOKIE-1' of length 16
000:>: Success, version is 11:0 vendor='The X.Org Foundation' release=11103000 resource-id=0x01c00000 resource-mask=0x001fffff motion-buffer-size=256 max-request-len=65535 image-byte-order=LSBFirst(0x00) bitmap-bit-order=LeastSignificant(0x00) scanline-unit=32 scanline-pad=32 min-keycode=0x08 max-keycode=0x00 pixmap-formats={depth=1 bits/pixel=1 scanline-pad=32},{depth=4 bits/pixel=8 scanline-pad=32},{depth=8 bits/pixel=8 scanline-pad=32},{depth=15 bits/pixel=16 scanline-pad=32},{depth=16 bits/pixel=16 scanline-pad=32},{depth=24 bits/pixel=32 scanline-pad=32},{depth=32 bits/pixel=32 scanline-pad=32}; roots={root=0x000000aa default-colormap=0x00000020 white-pixel=0x00ffffff black-pixel=0x00000000 input-mask=EnterWindow,PointerMotion,StructureNotify,SubstructureRedirect,PropertyChange width[pixel]=102
[delexi@lexi-n120 ~]$ x11trace xprop -id 0x160067b
No display name to create specified, trying :9
Got connection from unknown(local)
000:<: am lsb-first want 11:0 authorising with 'MIT-MAGIC-COOKIE-1' of length 16
000:>: Success, version is 11:0 vendor='The X.Org Foundation' release=11103000 resource-id=0x01c00000 resource-mask=0x001fffff motion-buffer-size=256 max-request-len=65535 image-byte-order=LSBFirst(0x00) bitmap-bit-order=LeastSignificant(0x00) scanline-unit=32 scanline-pad=32 min-keycode=0x08 max-keycode=0x00 pixmap-formats={depth=1 bits/pixel=1 scanline-pad=32},{depth=4 bits/pixel=8 scanline-pad=32},{depth=8 bits/pixel=8 scanline-pad=32},{depth=15 bits/pixel=16 scanline-pad=32},{depth=16 bits/pixel=16 scanline-pad=32},{depth=24 bits/pixel=32 scanline-pad=32},{depth=32 bits/pixel=32 scanline-pad=32}; roots={root=0x000000aa default-colormap=0x00000020 white-pixel=0x00ffffff black-pixel=0x00000000 input-mask=EnterWindow,PointerMotion,StructureNotify,SubstructureRedirect,PropertyChange width[pixel]=102
[delexi@lexi-n120 ~]$ xwininfo -all -id 0x160067b
xwininfo: Window id: 0x160067b (has no name)
Root window id: 0xaa (the root window) "i3"
Parent window id: 0x160067a "delexi@lexi-n120:~"
0 children.
Absolute upper-left X: 0
Absolute upper-left Y: 19
I=0
while IFS= read -rd '' f; do echo $f ; ((I++));
done << $(find $1)
#yields: line 13: warning: here-document at line 9 delimited by end-of-file (wanted `$(find $1)')
val keys = List("key1",key2")
val input = List("line1","line2",line3")
val regex = List("(line1).r","(line3)".r)
keys.zip(input.flatMap((line) => regex.flatMap(_ unapplySeq line).flatten()))
@delexi
delexi / gist:2016076
Created March 11, 2012 11:22
Directory History
trait History {
private val history = new ArrayBuffer[File]
private var current = 0;
def isAvailable(distance: Int) = {
if (!history.isEmpty && current + distance >= 0 && current + distance <= history.length - 1) {
true
} else false
}
@delexi
delexi / gist:2017891
Created March 11, 2012 19:57
Comparator
//Das ist dein Comparator. Die Typangabe in spitzen klammern gibt an
//welche Objekte dieser Comparator vergleichen kann.
class MyComparator extends Comparator<Double> {
// Das ist die methode die z.b. von Collections.sort() aufgerufen wird und nach
// der die objekte in der Collection (z.b. ArrayList) sortiert werden.
public int compare(Double d1, Double d2) {
// Wenn du hier jetzt -1 zurück gibst heißt das, dass d1 < d2
// Wenn du hier jetzt 0 zurück gibst heißt das, dass d1 = d2
// Wenn du hier jetzt 1 zurück gibst heißt das, dass d1 > d2
}
for (int x = 0; x < board.getWidth(); x++) {
for (int y = 0; y < board.getHeight(); y++) {
Position pos = new Position(x, y);
if (board.get(x, y) == Tile.EMPTY) {
for (Position direction : directions) {
if (checkLine(pos, direction, player) && !ret.contains(pos)) {
ret.add(pos);
}
}
}
object Justification extends Enumeration {
val Left = Value(TableLayoutConstants.LEFT)
val Top = Value(TableLayoutConstants.TOP)
val Center = Value(TableLayoutConstants.CENTER)
val Full = Value(TableLayoutConstants.FULL)
val Bottom = Value(TableLayoutConstants.BOTTOM)
val Right = Value(TableLayoutConstants.RIGHT)
}
sealed trait Enum
case class Element1 extends Enum
case class Element2 extends Enum
...
case class ElementN extends Enum