repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
sarojit2018/Deep-Edges | inference.py | <reponame>sarojit2018/Deep-Edges<filename>inference.py
from dataloader import *
from model import deepEdge
import numpy as np
import cv2
import tensorflow as tf
from keras.models import *
from keras.layers import *
from keras.optimizers import *
from keras.callbacks import ModelCheckpoint, LearningRateScheduler
from k... |
sarojit2018/Deep-Edges | losses.py | <reponame>sarojit2018/Deep-Edges<filename>losses.py
import numpy as np
import os
import skimage.io as io
import skimage.transform as trans
import numpy as np
from keras.models import *
from keras.layers import *
from keras.optimizers import *
from keras.callbacks import ModelCheckpoint, LearningRateScheduler
from keras... |
sarojit2018/Deep-Edges | dataloader.py | import numpy as np
import cv2
from random import random
from random import shuffle
from random import randint
from random import uniform
import os
import matplotlib.pyplot as plt
def datastreamer_BIPED(batch_size = 10 , target_shape = (512,512), mode = 'train', base_path = '/Users/sarojitauddya/edges_detect/BIPED/edge... |
Arkellus/Fugu14_onlinebuild | wait_login.py | from os.path import exists
import time
while not exists('./DONE'):
print("not done")
time.sleep(5) |
Arkellus/Fugu14_onlinebuild | cdhash_patch.py | <filename>cdhash_patch.py<gh_stars>1-10
#!/usr/bin/env python3
import sys
cdhash = sys.argv[1]
print(f"CDHash of jailbreakd: {cdhash}")
print("Patching arm/iOS/Fugu14App/Fugu14App/closures.swift...")
with open("./arm/iOS/Fugu14App/Fugu14App/closures.swift", "r") as f:
closure_swift = f.read()
lines = []
for line... |
hdjang/SSD-variants | train.py | import os
import time
import argparse
import random
import numpy as np
from numpy.random import RandomState
import cv2
import torch
import torch.optim as optim
import torch.backends.cudnn as cudnn
from torch.autograd import Variable
from torch.utils.data import DataLoader
from pascal_voc import VOCDete... |
hdjang/SSD-variants | models/SSD.py | # "SSD: Single Shot MultiBox Detector" <NAME> et al. ECCV16
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
import os
import itertools
from collections import OrderedDict
from vgg import VGG16 # VGG16 as backbone
class ... |
lpninja/ELCCpv1 | ELCCpv1.py | #!/usr/bin/env python
"""ELCCpv1.py: Sets the ElectriCChain standard syntax for the TXID space in the blockchain comments for connecting Solar PV inverters and data-loggers to the blockchain. Works with any blockchain running a daemon and having space to add a text comment only limited by the number of text characters.... |
dailab/roomba-python | game.py | #
# game.py
#
# Simple tester for the Roomba Interface
# from create.py
#
# Adjust your ROOMBA_PORT if necessary.
# python game.py
# starts a pygame window from which the
# Roomba can be controlled with w/a/s/d.
# Use this file to play with the sensors.
import os, sys
import pygame
import create
import time
# Change... |
dailab/roomba-python | starwars.py | <reponame>dailab/roomba-python<filename>starwars.py
# Taken from
# https://gist.github.com/thenoviceoof/5465084
# but modified to work on my Roomba 770
import time
import create
#ROOMBA_PORT = "/dev/tty.usbserial-DA017V6X"
ROOMBA_PORT = "/dev/rfcomm0"
# define silence
r = 30
# map note names in the lilypad notation... |
dailab/roomba-python | demo.py | <gh_stars>0
import create
import time
import io
import os
import sys
import argparse
# define silence
r = 30
# map note names in the lilypad notation to irobot commands
c4 = 60
cis4 = des4 = 61
d4 = 62
dis4 = ees4 = 63
e4 = 64
f4 = 65
fis4 = ges4 = 66
g4 = 67
gis4 = aes4 = 68
a4 = 69
ais4 = bes4 = 70
b4 = 71
c5 = 72
... |
pvaneck/tfjs-core | scripts/process_images_for_training.py | <filename>scripts/process_images_for_training.py
# Copyright 2017 Smesh LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENS... |
pvaneck/tfjs-core | scripts/convert_uint8_tensor_to_png.py | <gh_stars>10-100
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... |
andrelikesdogs/sm64-randomizer | sm64r/Area.py | <filename>sm64r/Area.py
from typing import Dict
class Area:
def __init__(self, area_id : int, name : str, properties : Dict):
self.id = area_id
self.name = name
self.properties = properties
def __str__(self):
return f'<Area {hex(self.id)}: {self.name}>: {repr(self.properties)}' |
andrelikesdogs/sm64-randomizer | sm64r/RandomModules/Objects/Whitelist.py | <gh_stars>10-100
from pathlib import Path
import json
import os
from sm64r.Constants import application_path
from sm64r.Entities import Object3D
DEBUG_HIT_INDICES = {}
class RandomizeObjectsWhitelist:
def __init__(self, whitelist):
self.object_whitelist = whitelist
def matches_with(self, matching, objec... |
andrelikesdogs/sm64-randomizer | sm64r/RandomModules/Text.py | <filename>sm64r/RandomModules/Text.py
import sys
import string
from random import shuffle
from typing import NamedTuple
from sm64r.Randoutils import format_binary
from sm64r.Entities.TextEntryDialog import TextEntryDialog
DATA_DIALOG_START = 0x803156
TBL_DIALOG_START = 0x81311E
TBL_DIALOG_END = TBL_DIALOG_START + 170... |
andrelikesdogs/sm64-randomizer | sm64r/RandomModules/Music.py | from random import shuffle
from typing import List
import logging
from sm64r.Parsers.Level import Level
from sm64r.Constants import SONG_NAMES
class MusicRandomizer:
def __init__(self, rom : 'ROM'):
self.rom = rom
def find_music_seqs(self, levels: List[Level]):
music_seq_ids = []
music_seq_pos = []
... |
andrelikesdogs/sm64-randomizer | sm64r/Level.py | from typing import List, Dict
from .Area import Area
class Level:
def __init__(self, course_id : int, name : str, properties : Dict = None, areas : List[Area] = None, offset : int = None):
self.course_id = course_id
self.name = name
self.properties = properties or {}
self.offset = offset
self.a... |
andrelikesdogs/sm64-randomizer | sm64r/Randoutils.py | import io
import math
from random import random
def hexlify(l):
if type(l) == list or type(l) == tuple:
return [(hexlify(v)) for v in l]
else:
if l == None:
return 'None'
else:
return hex(l)
def format_binary(bin_data):
if bin_data is None:
return 'NO DATA'
return ' '.join(hex(b)[... |
andrelikesdogs/sm64-randomizer | sm64r/RandomModules/Colors.py | from random import randint
import colorsys
import logging
class ColorRandomizer:
def __init__(self, rom : 'ROM'):
self.rom = rom
(start_segment_0x2, _) = self.rom.segments_sequentially[2]
self.coin_addresses = {
'YELLOW': start_segment_0x2 + 0x56cc,
'BLUE': start_segment_0x2 + 0x570c,
... |
andrelikesdogs/sm64-randomizer | sm64r/RandomModules/Instruments.py | <reponame>andrelikesdogs/sm64-randomizer
from random import shuffle, choice
from sm64r.Randoutils import format_binary
INSTRUMENT_SET_LENGTHS = [
6, # NLST 0 - SFX - 8000hz
9, # NLST 1 - SFX, Footsteps - 8000hz
3, # NLST 2 - SFX, Water - 8000hz
10, # NLST 3 - SFX, Sand (?) - 8000hz
16, # NLST 4 - SFX - 8000h... |
andrelikesdogs/sm64-randomizer | sm64r/Entities/BaseMemoryRecord.py | from typing import NamedTuple, Union
import math
class MemoryMapping(NamedTuple):
address_start: int
address_end : int
data_type: Union[str, tuple] # uint, int,
@property
def size(self):
return self.address_end - self.address_start
class BaseMemoryRecord:
memory_address = None
memory_mapping = Non... |
andrelikesdogs/sm64-randomizer | sm64r/Parsers/Imaging.py | <reponame>andrelikesdogs/sm64-randomizer<gh_stars>10-100
from PIL import Image
import numpy as np
class N64Image:
def __init__(self, img : Image):
self.img = img
self.bytes_original = self.img.tobytes()
@staticmethod
def scale_8_to_5(val):
return int(((((val) + 4) * 0x1F) / 0xFF))
@staticmethod
... |
andrelikesdogs/sm64-randomizer | sm64r/Scripts/find_star_locations.py | <filename>sm64r/Scripts/find_star_locations.py
import struct
import re
from Rom import ROM
rom_path = "Super Mario 64.z64"
rom_out = "Super Mario 64.ext.out.z64"
behaviour_locations = [
(0xF0000, 0x1FFFFF)
]
known_star_locations = {
'BOB: Koopa the Quick': (3030, 4500, -4600), # short
'THI: Koopa the Quick': ... |
andrelikesdogs/sm64-randomizer | tests/test_config.py | import pytest
from Config import Config
def test_vanilla_rom():
config = Config.find_configuration(0x635a42c5) # Vanilla US ROM
assert config is not None, "Configuration not found for Vanilla US ROM Checksum"
assert config.name, "Missing Name"
assert len(config.checksums) > 0, "Missing Checksums"
asser... |
andrelikesdogs/sm64-randomizer | sm64r/Constants.py | from pathlib import Path
import os
import json
import sys
from .Parsers.Level import Level
application_path = None
if getattr(sys, 'frozen', False):
#print("frozen")
#print("exec: ", sys.executable)
#print("argv:", sys.argv[0])
application_path = os.path.realpath(os.path.dirname(sys.executable))
else:
#prin... |
andrelikesdogs/sm64-randomizer | sm64r/RandomModules/Mario.py | from random import randint, choice
from sm64r.Randoutils import clamp
import logging
import math
# SM64 USA (BE) ROM Position
# 0x823B64
MEM_COLOR_ADDRESSES = {
'OVERALLS': 0x0,
'HAT_AND_SHIRT': 0x20,
'GLOVES': 0x38,
'SHOES': 0x48,
'SKIN': 0x60,
'HAIR': 0x80
}
CLOTH_COLORS = [(255, 255, 255), (173, 36, 3... |
andrelikesdogs/sm64-randomizer | sm64r/Parsers/GeoLayoutParser.py | <reponame>andrelikesdogs/sm64-randomizer
from sm64r.Randoutils import format_binary
COMMAND_LENGTHS = {
0x00: 8,
0x01: 4,
0x02: 8,
0x03: 4,
0x04: 4,
0x05: 4,
0x06: 4,
0x07: 4,
0x08: 12,
0x09: 4,
0x0A: None, # min 8
0x0B: 4,
0x0C: 4,
0x0D: 8,
0x0E: 8,
0x0F: 20, # 0x14
0x10: 16, # 0x10
... |
andrelikesdogs/sm64-randomizer | sm64r/Entities/TextEntryDialog.py | from typing import NamedTuple
from sm64r.Entities.BaseMemoryRecord import BaseMemoryRecord, MemoryMapping
class TextEntryDialog(BaseMemoryRecord):
memory_address_text: int = None
memory_address_pointer: int = None
text: str = None
entry_id: int = None
def __init__(self, entry_id, text, offset, mem_address_... |
andrelikesdogs/sm64-randomizer | sm64r/Parsers/Level.py | from typing import NamedTuple
from sm64r.Randoutils import format_binary
LVL_CMD_LOAD_RAW_DATA_AND_JUMP = "LOAD_RAW_DATA_AND_JUMP"
LVL_CMD_LOAD_RAW_DATA_AND_JUMP_PLUS_CALL = "LOAD_RAW_DATA_AND_JUMP_PLUS_CALL"
LVL_CMD_END_LEVEL_DATA = "END_LEVEL_DATA"
LVL_CMD_DELAY_FRAMES = "DELAY_FRAMES"
LVL_CMD_DELAY_FRAMES_2 = "DELA... |
andrelikesdogs/sm64-randomizer | sm64r/RandomModules/Stardoors.py | import sm64r.Constants as Constants
from sm64r.Parsers.CollisionPresets import CollisionPresetParser
CASTLE_DOORS_TO_REPLACE = [
(0x22, 0x13000B0C), # 0 Star Door
(0x23, 0x13000B0C), # 1 Star Door
(0x24, 0x13000B0C), # 3 Star Door
]
KEY_DOORS = [
(0x25, 0x13000AFC), # Keyhole Door
]
CASTLE_DOOR_LEVEL_MAPPING... |
andrelikesdogs/sm64-randomizer | sm64r/Entities/Warp.py | from typing import NamedTuple
from sm64r.Entities.BaseMemoryRecord import BaseMemoryRecord, MemoryMapping
class Warp(BaseMemoryRecord):
to_area_id: int
to_course_id: int
to_warp_id: int
warp_id: int
type: str = "NORMAL" # INSTANT, NORMAL, PAINTING
anim_type: str = None
area_id: int
has_checkpoint: boo... |
andrelikesdogs/sm64-randomizer | sm64r/RandomModules/Textures.py | <reponame>andrelikesdogs/sm64-randomizer
from typing import List, Union, NamedTuple
import numpy as np
from PIL import Image
from pathlib import Path
import os
from sm64r.Parsers.Imaging import Imaging, N64Image
from sm64r.Constants import application_path
class Texture(NamedTuple):
position: int
size: int
widt... |
andrelikesdogs/sm64-randomizer | sm64r/RandomModules/Warps.py | <reponame>andrelikesdogs/sm64-randomizer
from random import shuffle, choice
import logging
import os
from sm64r.Constants import LVL_CASTLE_COURTYARD, LVL_CASTLE_INSIDE, LVL_CASTLE_GROUNDS, LVL_THI, ALL_LEVELS, LEVEL_ID_MAPPING, LEVEL_SHORT_CODES, LVL_BOWSER_1, LVL_BOWSER_1_BATTLE, LVL_BOWSER_2, LVL_BOWSER_2_BATTLE, L... |
andrelikesdogs/sm64-randomizer | sm64r/RandomModules/Skybox.py | <filename>sm64r/RandomModules/Skybox.py
from random import choice
from sm64r.Randoutils import format_binary
import math
# Skyboxes
SKYBOX_IDS = [
0x00, # Bob-Omb's Battlefield
0x01, # Lethal Lava Land
0x02, # Wet Dry World
0x03, # Rainbow Ride
0x04, # Cool, Cool Mountain
0x05, # Shifting Sand Land
0x06,... |
andrelikesdogs/sm64-randomizer | sm64r/Enhancements/TextureChanges.py | from sm64r.RandomModules.Textures import TextureAtlas
class TextureChanges:
def __init__(self, rom):
self.rom = rom
def remove_tree_shadows(self):
TextureAtlas.hide_texture(self.rom, "castle_grounds_tree_shadow")
|
rohanb1985/PerforceHandler | P4VMergeSpecificCLCustomTool.py | from perforce.PerforceUtils import PerforceUtils
from perforce.PerforceMerge import PerforceMerge
import datetime
import yaml
import os
import sys
import pprint
print ("Starting Merge at: " +str(datetime.datetime.now()))
#fetchConfig
userConfigurationMap = list()
configFile ="config\config.yml"
if not o... |
rohanb1985/PerforceHandler | perforce/PerforceMerge.py | from perforce.PerforceUtils import PerforceUtils
from utils.MyLogger import MyLogger
import yaml
import pprint
import re
class PerforceMerge:
def __init__(self, ipP4, ipSubmittedChangeLists, ipUserConfigurationMap):
self.p4 = ipP4
self.submittedChangeLists = ipSubmittedChangeLists
self.userConfigura... |
rohanb1985/PerforceHandler | perforce/PerforceUtils.py | from P4 import P4,P4Exception
from utils.MyLogger import MyLogger
import os
import pprint
import datetime
class PerforceUtils:
def __init__(self, **args):
if args.get('p4host') is None and args.get('ipP4') is None:
exit ("Either of P4 Host or the P4 object should be sent!")
if args.get("p4host"... |
rohanb1985/PerforceHandler | P4VMergeCLCustomTool.py | <filename>P4VMergeCLCustomTool.py
from perforce.PerforceUtils import PerforceUtils
from perforce.PerforceMerge import PerforceMerge
import datetime
import yaml
import os
import sys
import pprint
print ("Starting Merge at: " +str(datetime.datetime.now()))
#fetchConfig
userConfigurationMap = list()
home = ... |
josephlewis42/personal_codebase | python/least_subset_solver.py | #!/usr/bin/env python
# Apache License 2011-11 <NAME> <<EMAIL>>
import re
while True:
f_name = raw_input("Enter the name of the file or q to quit: ")
if f_name == 'q':
exit()
with open(f_name) as f:
tmp = map(float, re.sub('[^0-9 -.]','',f.read()).split(' ')) # Read the file (removing garbage), split it, an... |
josephlewis42/personal_codebase | python/randall/alife_randall_checkout/ai_webserver/login.py | # login.py
#
# Copyright 2011 <NAME> <<EMAIL>>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any la... |
josephlewis42/personal_codebase | python/OpenCalc/Lib/Code/Functions/Standard.py | <gh_stars>1-10
'''
Description Of Module
@Author = <NAME><<EMAIL>>
@Date = 2010-2-24
@License = GPL
==Changelog==
2010-2-24 - First version made by <NAME>
2010-03-04 - Abs fixed so it will not return a string, and print an error Joseph Lewis
2010-03-17 - Abs fixed from a prior error, in which it didn't work (abs used i... |
josephlewis42/personal_codebase | python/auto_summary/AutoSummary.py | <reponame>josephlewis42/personal_codebase
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''Provides An Automated Summary of a document.
Copyright 2011 <NAME> <joehms22 [at] gmail com>
Originally Made: 2011-09-21
Redistribution and use in source and binary forms, with or without
modification, are permitted provided t... |
josephlewis42/personal_codebase | python/py_basic_ide/pyBASIC/runner.py | import time
debug = False
def error_fx(text):
'''The default error handling, print the text to the console.
replace with your own function if you want, have it print to your
wx application or whatever.'''
sys.stderr.write(text)
def output_fx(text):
'''The default output handling, print text to... |
josephlewis42/personal_codebase | python/pyWebserver/webserver.py | <gh_stars>1-10
'''
Copyright 2009 <NAME> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software... |
josephlewis42/personal_codebase | python/Genetic Programming/Finished Programs/2010-08-25 GP Test One.py | #!/usr/bin/python
from pyevolve import *
import math
error_accum = Util.ErrorAccumulator()
def gp_add(a, b):
return a+b
def gp_sub(a,b):
return a-b
def gp_mul(a, b):
return a*b
def gp_div(a,b):
'''
"Safe" division, if divide by 0, return 1.
'''
if b == 0:
return 1.0
else:
return ... |
josephlewis42/personal_codebase | Euler/001.py | #!/usr/bin/env python
'''
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
'''
threes = [i for i in range(0,1000,3)]
fives = [i for i in range(0,1000,5)]
print sum(set(threes + fives... |
josephlewis42/personal_codebase | python/randall/alife_randall_checkout/ai_webserver/emotions.py | <gh_stars>1-10
# emotions.py
#
# Copyright 2011 <NAME> <<EMAIL>>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at y... |
josephlewis42/personal_codebase | python/exe_reader.py | <reponame>josephlewis42/personal_codebase<filename>python/exe_reader.py
#!/usr/bin/env python
'''
A program that extracts strings from binary files.
Usage: reader.py path/to/file
Apache License <NAME> <<EMAIL>> 2011
'''
import sys
numstrs = 0
with open(sys.argv[1]) as j:
j = j.read()
mystr = ""
for i in range(0,... |
josephlewis42/personal_codebase | wheel_of_fortune_ai/wordgraph.py | <reponame>josephlewis42/personal_codebase<filename>wheel_of_fortune_ai/wordgraph.py
import collections
class NgramGraph:
graph = None
def __init__(self):
self.graph = collections.defaultdict(list)
def add_edge(from_node, to_node, score):
graph[from_node].append((score, to_node))
graph[from_node] = sorted... |
josephlewis42/personal_codebase | python/chat/server.py | # Server program
from socket import *
# Set the socket parameters
host = gethostname()
print host
port = 21567
buf = 1024
addr = (host,port)
# Check what port to open
print "What port, the usual is 21567?"
port = raw_input('Port >> ')
if not port:
port = 21567
addr = (host,int(port))
# Create socket and bind to... |
josephlewis42/personal_codebase | python/distributed_hash_table.py | #!/usr/bin/env python3
import SocketServer, subprocess, sys
from threading import Thread
HASH_LENGTH = 32
NUM_HASHES = 2**HASH_LENGTH
START_HASH = 0
END_HASH = 0
port = 8000
next_host = ""
next_port = ""
prev_host = ""
prev_port = ""
hashed_items = {}
def recv_all(socket):
total_data=[]
while True:
data = sock... |
josephlewis42/personal_codebase | python/randall/alife_randall_checkout/ai_webserver/stats.py | # stats.py
#
# Copyright 2011 <NAME> <<EMAIL>>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any la... |
josephlewis42/personal_codebase | blog/dns_message.py | <reponame>josephlewis42/personal_codebase<gh_stars>1-10
#!/usr/bin/env python3
''' A program to send messages via DNS queries.
Copyright 2013 <NAME> <<EMAIL>> | <<EMAIL>>
MIT License
'''
import subprocess
DNS_SERVER = '8.8.8.8'
DOMAIN_NAME = "www.testdnsflagsetting{}.com"
NORECURSE_OPT = "+norecurse"
msg = raw_inpu... |
josephlewis42/personal_codebase | python/randall/alife_randall_checkout/ai_webserver/chat.py | # chat.py -- A simple chat mechanism.
#
# Copyright 2011 <NAME> <<EMAIL>>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# ... |
josephlewis42/personal_codebase | python/py_basic_ide/MAIN.pyw | <filename>python/py_basic_ide/MAIN.pyw
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# generated by wxGlade 0.6.3 on Tue May 18 15:24:52 2010
import wx
#YYYYMMDD.HHMMSS of this release.
__version__ = 20100528
human_version = "2010-05-28"
# begin wxGlade: extracode
import pyBASIC
import threading
import time
thread_... |
josephlewis42/personal_codebase | python/image_generator.py | #!/usr/bin/env python
import os
import random
def write_pgm(filename, content, width):
'''Writes a pgm image file from the given content, with width being
given. The contnet written is the value at the content at the position,
if contnet was [1,0,1,0] and width was 2 the pixels would end up being
... |
josephlewis42/personal_codebase | python/gamebot/game_searcher.py | import codescraper
DEBUGGING = True
class NoResultsException(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
class GameSearcher:
'''The game searcher class provides a framework for searching Google for
swfs.'''
_page_list = []
... |
josephlewis42/personal_codebase | python/OpenCalc/Lib/Code/Functions/Template.py | <reponame>josephlewis42/personal_codebase
'''
Description Of Module
@Author = Author
@Date = Date
@License = GPL
==Changelog==
Date - Change
Date2 - Change2
'''
#Import Statements
#Define Constants
#Define Functions
|
josephlewis42/personal_codebase | python/randall/alife_randall_checkout/randallai/AI/pavlov.py | #!/usr/bin/env python
'''
Copyright (c) 2011 <NAME> <<EMAIL>>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later ve... |
josephlewis42/personal_codebase | python/py_basic_ide/pyBASIC/parser.py | <gh_stars>1-10
#!/usr/bin/python
SHOW_ERRORS = True
import sys
def error_fx(text):
'''The default error handling, print the text to the console.
replace with your own function if you want, have it print to your
wx application or whatever.'''
sys.stderr.write(text)
def show_error(text):
'''
Send ... |
josephlewis42/personal_codebase | python/dns.py | <filename>python/dns.py
#!/usr/bin/env python
'''
Copyright (c) 2010 <NAME> <<EMAIL>>
SIMPLE DNS TEST SERVER
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, ... |
josephlewis42/personal_codebase | python/gamebot/games_db.py | #!/usr/bin/env python
''' Provides a database for games
Copyright (c) 2011 <NAME> <<EMAIL>>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the r... |
josephlewis42/personal_codebase | python/gamebot/games_server.py | #!/usr/bin/env python
''' Provides a database for games
Copyright (c) 2011 <NAME> <<EMAIL>>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the r... |
josephlewis42/personal_codebase | Euler/009.py | #!/usr/bin/env python
'''
A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
a2 + b2 = c2
For example, 32 + 42 = 9 + 16 = 25 = 52.
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.
'''
import pymath
trip = pymath.primitive_pythagorean_triples... |
josephlewis42/personal_codebase | python/Genetic Programming/Examples/pyevolve_ex17_gtree.py | from pyevolve import GSimpleGA
from pyevolve import GTree
from pyevolve import Crossovers
from pyevolve import Mutators
import time
import random
def eval_func(chromosome):
score = 0.0
# If you want to add score values based
# in the height of the Tree, the extra
# code is commented.
#height = chromoso... |
josephlewis42/personal_codebase | python/reprap-franklin/firmware/__init__.py | <reponame>josephlewis42/personal_codebase
import full #Full firmware implementation.
#Individual Firmwares Here
import repman
import gen5 |
josephlewis42/personal_codebase | python/pretty_diff.py | '''
Generates a diff when given two arguments, and opens the web browser to display
it.
Copyright (c) 2013, <NAME> <<EMAIL>> | <<EMAIL>>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributi... |
josephlewis42/personal_codebase | python/reprap-franklin/inputs/unix_socket.py | <reponame>josephlewis42/personal_codebase
#!/usr/bin/env python
'''Provides an interface between the RepRap Franklin and a UNIX socket.
VirtualBox can be configured to use a UNIX socket as an interface to
the virtual machine's serial port, this class opens up that file
and communicates with the RepRap software running... |
josephlewis42/personal_codebase | Euler/014.py | '''
Collatz sequence
The following iterative sequence is defined for the set of positive integers:
n -> n/2 (n is even)
n -> 3n + 1 (n is odd)
Using the rule above and starting with 13, we generate the following sequence:
13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1
It can be seen that this sequence (startin... |
josephlewis42/personal_codebase | python/Genetic Programming/Examples/pyevolve_ex20_gp_dotwrite.py | from pyevolve import *
import math
rmse_accum = Util.ErrorAccumulator()
def gp_add(a, b): return a+b
def gp_sub(a, b): return a-b
def gp_mul(a, b): return a*b
def gp_sqrt(a): return math.sqrt(abs(a))
def eval_func(chromosome):
global rmse_accum
rmse_accum.reset()
code_comp = chromosome.getCompiledCode(... |
josephlewis42/personal_codebase | python/monty_hall.py | <filename>python/monty_hall.py
#!/usr/bin/env python
#Monty Hall Problem
#
# switch = True : change doors
# switch = False: don't change doors
import random
import time
starttime = time.time()
def choose_door_to_open(one, two):
#If either of the doors is the one with the prize
if one or two:
if one:
... |
josephlewis42/personal_codebase | python/Genetic Programming/Examples/pyevolve_ex10_g1dbinstr.py | from pyevolve import G1DBinaryString
from pyevolve import GSimpleGA
from pyevolve import Selectors
from pyevolve import Mutators
# This function is the evaluation function, we want
# to give high score to more zero'ed chromosomes
def eval_func(chromosome):
score = 0.0
# iterate over the chromosome
for value ... |
josephlewis42/personal_codebase | python/archiver/archive.py | #!/usr/bin/env python
'''
Generates an "archived" version of some text by converting it to text/qr codes
in HTML.
'''
import StringIO
import urllib
import qrcode
import sys
import os
import hashlib
import datetime
CHARS_PER_SECTION = 500
def generate_file_info(filename, text):
'''Generates file information about t... |
josephlewis42/personal_codebase | python/reprap-franklin/toolheads/toolhead.py | <reponame>josephlewis42/personal_codebase
#!/usr/bin/env python
'''Provides an Extruder base class for the RepRap.
All extruders extend this class, and can therefore be chosen by the
user at runtime.
Copyright 2011 <NAME> <<EMAIL>>
This program is free software; you can redistribute it and/or modify
it under the ter... |
josephlewis42/personal_codebase | python/randall/alife_randall_checkout/ai_webserver/index.py | # index.py
#
# Copyright 2011 <NAME> <<EMAIL>>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any la... |
josephlewis42/personal_codebase | python/codescraper.py | <gh_stars>1-10
#!/usr/bin/python
'''Copyright 2010 <NAME> <<EMAIL>>
BSD License
Retrives Java code stored in an HTML page that is wrapped in <pre> tags.
'''
import re
import urllib2
import xml.sax.saxutils
numnones = 0
def unescape(string):
'''Unescape the & escapes in html, like " returns a string '''
... |
josephlewis42/personal_codebase | python/stemmer.py | <gh_stars>1-10
#!/usr/bin/env python
'''
An implementation of the PORTER2 algorithm for English stemming in
Python. Implemented from:
http://snowball.tartarus.org/algorithms/english/stemmer.html
Copyright 2012 <NAME> <<EMAIL>> | <<EMAIL>>
Redistribution and use in source and binary forms, with or without
modificatio... |
josephlewis42/personal_codebase | Euler/005.py | #!/usr/bin/env python
'''
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
'''
import pymath
# Know it must at least be a multiple of 20
print pymath.lcm_array(ra... |
josephlewis42/personal_codebase | python/OpenCalc/Lib/Code/Functions/__init__.py | <reponame>josephlewis42/personal_codebase
'''
Initiates all functions
use from MODULENAME import *
that way when this is imported the functions you provide can be easily accessable
'''
from Trig import *
from Fractions import *
from Standard import *
from Log_Exp import *
from Random import *
|
josephlewis42/personal_codebase | python/Genetic Programming/Examples/pyevolve_ex5_callback.py | <reponame>josephlewis42/personal_codebase
from pyevolve import G1DList
from pyevolve import GSimpleGA
from pyevolve import Selectors
# The step callback function, this function
# will be called every step (generation) of the GA evolution
def evolve_callback(ga_engine):
generation = ga_engine.getCurrentGeneration()
... |
josephlewis42/personal_codebase | python/OpenCalc/Lib/Code/Functions/Fractions.py | <gh_stars>1-10
'''
Works with fractions
@Author = <NAME>
@Date = 2/19/2010
@License = GPL
==Changelog==
2/19/2010 - Original Built by <NAME> <<EMAIL>>
2/23/2010 - Changed caps to lower case for ease of typing, added fareyLimit var, and added function simplify so it will be easier for users.
'''
#Import Statements
impor... |
josephlewis42/personal_codebase | python/pyportscanner.py | #!/usr/bin/env python
from socket import *
if __name__ == '__main__':
target = raw_input('Enter host to scan: ')
low = int(raw_input('Enter low port to scan:'))
hi = int(raw_input('Enter high port to scan:'))
targetIP = gethostbyname(target)
print 'Starting scan on host ', targetIP
#scan reser... |
josephlewis42/personal_codebase | python/Genetic Programming/Examples/pyevolve_ex14_ackley.py | from pyevolve import G1DList, GSimpleGA, Selectors
from pyevolve import Initializators, Mutators, Consts, DBAdapters
import math
# This is the Rastringin Function, a deception function
def ackley(xlist):
sum1 = 0
score = 0
n = len(xlist)
for i in xrange(n):
sum1 += xlist[i]*xlist[i]
t1 = math.exp(... |
josephlewis42/personal_codebase | python/Genetic Programming/Examples/pyevolve_ex7_rastrigin.py | <reponame>josephlewis42/personal_codebase
from pyevolve import GSimpleGA
from pyevolve import G1DList
from pyevolve import Mutators, Initializators
from pyevolve import Selectors
from pyevolve import Consts
import math
# This is the Rastrigin Function, a deception function
def rastrigin(genome):
n = len(genome)
... |
josephlewis42/personal_codebase | python/gamebot/email_fetch.py | <gh_stars>1-10
#!/usr/bin/env python
'''Provides an ability to send and recieve emails.
The EmailInterface class allows checking of an email box on demand,
along with on a fixed interval.
Copyright 2011 <NAME> <<EMAIL>>
This program is free software; you can redistribute it and/or modify
it under the terms of the GN... |
josephlewis42/personal_codebase | python/OpenCalc/Main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# generated by wxGlade 0.6.3 on Sat Feb 27 13:35:04 2010
import wx
# begin wxGlade: extracode
import wx.html as html
from Lib.Code import Parser
import sys
from Lib.Code import Frontend
import wxmpl
# end wxGlade
class CalcWidget(wx.Frame,Frontend.events):
def __init... |
josephlewis42/personal_codebase | python/OpenCalc/Lib/Code/Functions/Random.py | '''
Random makes random numbers.
@Author = <NAME> <<EMAIL>>
@Date = 2010-03-04
@License = GPL
==Changelog==
2010-03-04 - Module started.
'''
#Import Statements
import random as r
import time as t
#Define Constants
#Define Functions
def time():
'''
Return the current date.
'''
return t.asctime()
def... |
josephlewis42/personal_codebase | wheel_of_fortune_ai/common.py | <filename>wheel_of_fortune_ai/common.py
#!/usr/bin/env python3
'''
Provides common functions used through the similarity engines.
Author: <NAME> <<EMAIL>> | <<EMAIL>>
Copyright 2012, All Rights Reserved
2012-10-27 - Initial Work
'''
import re
import unittest
def document_to_terms(doc):
'''Parses a document in to a... |
josephlewis42/personal_codebase | Euler/007.py | <reponame>josephlewis42/personal_codebase<filename>Euler/007.py
#!/usr/bin/env python
'''
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10001st prime number?
'''
import pymath
print max(pymath.n_primes(10001))
|
josephlewis42/personal_codebase | python/OpenCalc/Lib/Code/Parser.py | <reponame>josephlewis42/personal_codebase
'''
This module takes care of doing math for the program.
@Author = <NAME>
@Date = Friday, Feb. 19, 2010
@License = GPL
==Changelog==
2/19/2010 - Original Built by <NAME> <<EMAIL>>
2/23/2010 - Added simple fixes for floating point errors, added ^ ** replace
2/25/2010 - Added a... |
josephlewis42/personal_codebase | python/randall/alife_randall_checkout/randallai/AI/logos.py | #!/usr/bin/env python
'''
The logos module provides a kind of decision making process center.
It has hints of imagination and logic.
Copyright (c) 2011 <NAME> <<EMAIL>>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by... |
josephlewis42/personal_codebase | Euler/016.py | '''
215 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
What is the sum of the digits of the number 21000?
'''
print(sum([int(i) for i in str(2 ** 1000)]))
|
josephlewis42/personal_codebase | Euler/004.py | <filename>Euler/004.py
#!/usr/bin/env python
'''
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 99.
Find the largest palindrome made from the product of two 3-digit numbers.
'''
import pymath
nums = []
for x in range(1000):
for y in ran... |
josephlewis42/personal_codebase | python/reprap-franklin/toolheads/basic.py | <reponame>josephlewis42/personal_codebase
#!/usr/bin/env python
'''Provides a basic extruder base class for the RepRap.
Copyright 2011 <NAME> <<EMAIL>>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundatio... |
josephlewis42/personal_codebase | python/randall/alife_randall_checkout/cgi_threaded_webserver.py | #!/usr/bin/env python
'''Copyright 2010 <NAME>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or ag... |
josephlewis42/personal_codebase | python/chat/client.py | <gh_stars>1-10
#!/usr/bin/python
from socket import *
#Define Variables
host = "localhost"
port = 21567
buf = 1024
addr = (host,port)
username = "User"
# Create socket
UDPSock = socket(AF_INET,SOCK_DGRAM)
def setup():
'''
Sets up the user profile, and the connection to the other computer
'''
#Impor... |
josephlewis42/personal_codebase | python/Genetic Programming/Examples/pyevolve_ex21_nqueens.py | <filename>python/Genetic Programming/Examples/pyevolve_ex21_nqueens.py<gh_stars>1-10
from pyevolve import G1DList
from pyevolve import Mutators, Crossovers
from pyevolve import Consts, GSimpleGA
from pyevolve import DBAdapters
from random import shuffle
# The "n" in n-queens
BOARD_SIZE = 64
# The n-queens fitness fun... |
josephlewis42/personal_codebase | python/python_webserver.py | #!/usr/bin/env python
'''
A very simple Python webserver that isn't very good.
'''
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
sitedir = "." #could set to /var/www if your normal site is there, etc.
class RequestHandler(BaseHTTPRequestHandler):
def _writeheaders(self):
self.send_response(200)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.