Skip to content

Instantly share code, notes, and snippets.

index=winevents* sourcetype="WinEventLog:System"
| dedup ComputerName, host
| rex field=ComputerName "(?<RealHostName>[\w\d\-]+)\..+"
| eval RealHostName=lower(RealHostName) | eval ReportedHostName=lower(host)
| where RealHostName!=ReportedHostName
| table RealHostName, ReportedHostName
@hortonew
hortonew / pygame1_blankWindow.py
Created January 11, 2013 00:07
Pygame - Get a blank window to come up
import pygame
pygame.init()
screen = pygame.display.set_mode((800,600))
if __name__ == "__main__":
while True:
pygame.display.flip()
@hortonew
hortonew / pyglet1_blankWindow.py
Created January 11, 2013 00:25
Pyglet - Get a blank window to come up
import pyglet
screen = pyglet.window.Window(800,600)
if __name__ == "__main__":
pyglet.app.run()
@hortonew
hortonew / pygame2_clearScreen.py
Last active December 10, 2015 23:08
Pygame - Clear Screen
import pygame
pygame.init()
screen = pygame.display.set_mode((800,600))
if __name__ == "__main__":
while True:
screen.fill((0,0,0))
pygame.display.flip()
@hortonew
hortonew / pyglet4_handleEvents.py
Created January 11, 2013 00:38
Pyglet - Handle Events
import pyglet
from pyglet.window import key
screen = pyglet.window.Window(800,600)
@screen.event
def on_key_press(symbol, modifiers):
if symbol == key.A:
print 'You pressed A'
@hortonew
hortonew / pyglet2_clearScreen.py
Last active December 10, 2015 23:08
Pyglet - Clear Screen
import pyglet
screen = pyglet.window.Window(800,600)
@screen.event
def on_draw():
screen.clear()
if __name__ == "__main__":
pyglet.app.run()
@hortonew
hortonew / pygame3_controlFPS.py
Created January 11, 2013 00:36
Pygame - Control FPS
import pygame
pygame.init()
screen = pygame.display.set_mode((800,600))
clock = pygame.time.Clock()
def update():
#update objects here
if __name__ == "__main__":
while True:
@hortonew
hortonew / pyglet3_controlFPS.py
Created January 11, 2013 00:37
Pyglet - Control FPS
import pyglet
screen = pyglet.window.Window(800,600)
def update(dt):
#update objects here
if __name__ == "__main__":
pyglet.clock.schedule_interval(update, 1/120.0)
pyglet.app.run()
@hortonew
hortonew / pygame4_handleEvents.py
Created January 11, 2013 00:38
Pygame - Handle Events
import pygame, sys
from pygame.locals import *
running = True
pygame.init()
screen = pygame.display.set_mode((800,600))
clock = pygame.time.Clock()
def handleEvents():
global running
@hortonew
hortonew / pygame5_imageText.py
Last active December 10, 2015 23:09
Pygame - Sprite image and Text label
import pygame, sys, os
running = True
pygame.init()
screen = pygame.display.set_mode((800,600))
clock = pygame.time.Clock()
#calculate current path + location of player image. Image must be on same level as this file
mypath = os.path.dirname( os.path.realpath( __file__) )
p_path = os.path.join(mypath, 'player.png')