This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from game import gamehandle | |
from file2 import givexp | |
def main(): | |
print('1) give xp') | |
print('2) give 500 xp') | |
donow = input() | |
if donow == '1': | |
givexp(200) #this is in File2.py | |
if donow == '2': | |
gamehandle.give_xp(500) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from game import gamehandle | |
def givexp(ammount): | |
gamehandle.load_variables() | |
gamehandle.give_xp(ammount) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Computer | |
******** | |
Summary | |
------- | |
-Computer- | |
Processor : 8x Intel(R) Core(TM) i7-2760QM CPU @ 2.40GHz | |
Memory : 16394MB (1352MB used) |