Skip to content

Instantly share code, notes, and snippets.

View Torxed's full-sized avatar

Anton Hvornum Torxed

View GitHub Profile
@Torxed
Torxed / lighttpd_error.log
Created July 18, 2013 10:35
General snippets of nothingness?
GET /test.php HTTP/1.1
Host: 127.0.0.1
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
@Torxed
Torxed / fcgi_app.py
Created July 18, 2013 11:52
A FastCGI client written in Python. A modified version of the one written by Allan Saddi
# Copyright (c) 2006 Allan Saddi <allan@saddi.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
@Torxed
Torxed / hardware.txt
Last active December 20, 2015 00:49
My hardware specs
Computer
********
Summary
-------
-Computer-
Processor : 8x Intel(R) Core(TM) i7-2760QM CPU @ 2.40GHz
Memory : 16394MB (1352MB used)
name of display: :0
display: :0 screen: 0
direct rendering: Yes
server glx vendor string: NVIDIA Corporation
server glx version string: 1.4
server glx extensions:
GLX_ARB_create_context, GLX_ARB_create_context_profile,
GLX_ARB_create_context_robustness, GLX_ARB_fbconfig_float,
GLX_ARB_multisample, GLX_EXT_buffer_age,
GLX_EXT_create_context_es2_profile, GLX_EXT_create_context_es_profile,
from threadimg import *
class worker(Thread):
def __init__(self, filehandle, password, crackflag):
Thread.__init__(self)
self.fh = filehandle
self.pwd = password
self.cracked = crackflag
self.start()
@Torxed
Torxed / test.py
Created May 8, 2014 11:39
Small Pyglet class based graphical application that rotates an image
import pyglet
from pyglet.gl import *
from collections import OrderedDict
from time import time
from os.path import abspath
class House(pyglet.sprite.Sprite):
def __init__(self):
self.texture = pyglet.image.load(abspath('./image.png'))
super(House, self).__init__(self.texture)
@Torxed
Torxed / test.py
Last active August 29, 2015 14:02
A short test in lookup-times on DNS records.
#!/usr/bin/python3
from socket import gethostbyname
from time import *
domains = ('cobra.com', 'tiger.com', 'ferrarri.com', 'amazon.com', 'thelongestdomainnameintheworldandthensomeandthensomemoreandmore.com', 'sockervadd.se')
for domain in domains:
start = time()
## This instructs the OS to do a DNS lookup.
gethostbyname(domain)
end = time()
# Part of my main class more often than not,
# this will do the actual drawing of lines
def draw_line(xy, dxy, color=(0.2, 0.2, 0.2, 1)):
glColor4f(color[0], color[1], color[2], color[3])
glBegin(GL_LINES)
glVertex2f(xy[0], xy[1])
glVertex2f(dxy[0], dxy[1])
glEnd()
# How to call it to get a two-line-thickness healthbar.
import pickle
gameVars = {'health' : 100, 'stamina' : 100} # 100% on both
print('Current health is:', gameVars['health'])
gameVars['health'] -= 25
pickle.dump(gameVars, open('game.dump', 'wb'))
del(gameVars)
try:
@Torxed
Torxed / game.py
Last active August 29, 2015 14:03
import pickle
class Game(object):
def __init__(self):
self.experience = 0
self.health = 0
self.loadedFromDisk = False
def give_xp(self, given_xp):
self.experience += given_xp
def save_variables(self):
with open('game.dump', 'wb') as fh: