Пример #1
0
# Python imports
import argparse
import os
import sys

# Local imports
from src import help
from src.errors import *
from src.initialize import Initialize
from src.configreader import ConfigReader

initializer = Initialize()
white_space = initializer.white_space
config_file = initializer.config_file
config_reader = ConfigReader(config_file)
# Gets the path to Desktop
desktop = os.path.join(os.environ['USERPROFILE'], "Desktop")

# Paths/Directories for different file types
paths = config_reader.read_config("hs-desktop")


def main():
    parser = argparse.ArgumentParser(add_help=False)
    parser.add_argument('--help', '-help', action='store_true')

    args = parser.parse_args()

    if args.help:
        cmd = sys.argv[0].partition(".")[0]
Пример #2
0
#                                                                           #
#    You should have received a copy of the GNU General Public License      #
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.  #
#############################################################################

# Python imports
import os

# Local imports
from src.errors import *
from src.initialize import Initialize
from src.configreader import ConfigReader

initializer = Initialize()
config_file = initializer.config_file
config_reader = ConfigReader(config_file)
main = initializer.basic_main

# Gets a list of all the music files in the directories and
# their sub-directories in the configuration file
music_files = config_reader.read_config("hs-music")


def execute():
    if music_files:
        # Playlist path
        playlist = os.path.join(initializer.BASE_DIRECTORY, 'playlist.m3u')

        with open(playlist, 'w') as f:
            for file in music_files:
                f.write(file + '\n')
Пример #3
0
#                                                                           #
#    You should have received a copy of the GNU General Public License      #
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.  #
#############################################################################

# Python imports
import os

# Local imports
from src.errors import *
from src.initialize import Initialize
from src.configreader import ConfigReader

initializer = Initialize()
config_file = initializer.config_file
config_reader = ConfigReader(config_file)
main = initializer.basic_main
# List of files and the text editor to open them with
files, editor = config_reader.read_config("hs-work")

if not editor:
    raise ConfigError("No editor specified for the files")


def execute():
    if len(files) > 0:
        for file in files:
            print(" Opening", file)
            os.system('START "" "{0}" "{1}"'.format(editor, file))

    # If no files are specified in config.ini
Пример #4
0
#                                                                           #
#    You should have received a copy of the GNU General Public License      #
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.  #
#############################################################################

# Python imports
import os

# Local imports
from src.errors import *
from src.initialize import Initialize
from src.configreader import ConfigReader

initializer = Initialize()
config_file = initializer.config_file
config_reader = ConfigReader(config_file)
main = initializer.basic_main
# List of programs/files to be opened (will be filled later)
files = config_reader.read_config("hs-start")


def execute():
    # At least one program / file must be specified in the config
    if len(files) > 0:
        for file in files:
            if os.path.isfile(file):
                print(" Opening", file)
                os.startfile(file)
            else:
                print(" Skipping", file, "since it does not exist")
    else:
Пример #5
0
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.  #
#############################################################################

# Python imports
import argparse
import os
import sys

# Local imports
from src import help
from src.initialize import Initialize
from src.configreader import ConfigReader

initializer = Initialize()
config_file = initializer.config_file
config_reader = ConfigReader(config_file)
# Gets a Extensions-Directory key-value pair
loc_pairs = config_reader.read_config("hs-manage")


def main():
    parser = argparse.ArgumentParser(add_help=True, allow_abbrev=False)
    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument('-d',
                       '--directory',
                       nargs=1,
                       metavar='DIR',
                       help='directory to manage files in')
    group.add_argument('-dh',
                       '--dhelp',
                       action='store_true',
Пример #6
0
#                                                                           #
#    You should have received a copy of the GNU General Public License      #
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.  #
#############################################################################

# Python imports
import os

# Local imports
from src.errors import *
from src.initialize import Initialize
from src.configreader import ConfigReader

initializer = Initialize()
config_file = initializer.config_file
config_reader = ConfigReader(config_file)
main = initializer.basic_main
# List of programs/files to be opened (will be filled later)
files = config_reader.read_config("hs-start")


def execute():
    # At least one program / file must be specified in the config
    if len(files) > 0:
        for file in files:
            if os.path.isfile(file):
                print(" Opening", file)
                os.startfile(file)
            else:
                print(" Skipping", file, "since it does not exist")
    else:
Пример #7
0
import os
from src.configreader import ConfigReader
from src.dataset import Dataset
from src.autoencoder import Autoencoder

if __name__ == "__main__":

    config_path = os.path.join(os.path.dirname(__file__), "config.json")

    config_obj = ConfigReader(config_path)

    dataset = Dataset(config_obj)
    x_train = dataset.load_train_data()
    x_val = dataset.load_val_data()
    x_eval = dataset.load_eval_data()
    model = Autoencoder(config_obj, dataset)

    model.set_iterators(x_train, x_val, eval_from_input_iterator=x_eval)

    for i in range(12000):
        # the evaluation is quite time intensive, during it off increase the speed
        do_evaluation = i % 500 == 0 and i > 0
        stats = model.train(do_evaluation)
        print("{}: {}".format(i, stats["loss"]))
        if "val_loss" in stats:
            print("Val loss: {}".format(stats["val_loss"]))
            print("IO: {}, l1: {}".format(stats['iou'], stats["eval_l1"]))
        if i % 1000 and i > 0:
            model.save(config_obj.data.get_string("model_save_path"))
Пример #8
0
# Python imports
import argparse
import os
import sys

# Local imports
from src import help
from src.errors import *
from src.initialize import Initialize
from src.configreader import ConfigReader

initializer = Initialize()
white_space = initializer.white_space
config_file = initializer.config_file
config_reader = ConfigReader(config_file)
# Gets the path to Desktop
desktop = os.path.join(os.environ['USERPROFILE'], "Desktop")

# Paths/Directories for different file types
paths = config_reader.read_config("hs-desktop")



def main():
    parser = argparse.ArgumentParser(add_help=False)
    parser.add_argument('--help',
                        '-help',
                        action='store_true')

    args = parser.parse_args()
Пример #9
0
#                                                                           #
#    You should have received a copy of the GNU General Public License      #
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.  #
#############################################################################

# Python imports
import os

# Local imports
from src.errors import *
from src.initialize import Initialize
from src.configreader import ConfigReader

initializer = Initialize()
config_file = initializer.config_file
config_reader = ConfigReader(config_file)
main = initializer.basic_main

# Gets a list of all the music files in the directories and
# their sub-directories in the configuration file
music_files = config_reader.read_config("hs-music")


def execute():
    if music_files:
        # Playlist path
        playlist = os.path.join(initializer.BASE_DIRECTORY, 'playlist.m3u')

        with open(playlist, 'w') as f:
            for file in music_files:
                f.write(file + '\n')
Пример #10
0
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.  #
#############################################################################

# Python imports
import argparse
import os
import sys

# Local imports
from src import help
from src.initialize import Initialize
from src.configreader import ConfigReader

initializer = Initialize()
config_file = initializer.config_file
config_reader = ConfigReader(config_file)
# Gets a Extensions-Directory key-value pair
loc_pairs = config_reader.read_config("hs-manage")


def main():
    parser = argparse.ArgumentParser(add_help=True, allow_abbrev=False)
    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument('-d',
                       '--directory',
                       nargs=1,
                       metavar='DIR',
                       help='directory to manage files in')
    group.add_argument('-dh',
                       '--dhelp',
                       action='store_true',
Пример #11
0
#    GNU General Public License for more details.                           #
#                                                                           #
#    You should have received a copy of the GNU General Public License      #
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.  #
#############################################################################

# Python imports
import webbrowser

# Local imports
from src.initialize import Initialize
from src.configreader import ConfigReader

initializer = Initialize()
config_file = initializer.config_file
config_reader = ConfigReader(config_file)
main = initializer.basic_main

# List of URLs to open (will be filled later)
urls = config_reader.read_config("hs-browse")


def execute():
    for url in urls:
        print(" Opening", url)
        # Opens the URL with the default browser
        webbrowser.open(url)


if __name__ == "__main__":
    main(execute)
Пример #12
0
#############################################################################

# Python imports
import argparse
import os
import sys

# Local imports
from src import help
from src.errors import *
from src.initialize import Initialize
from src.configreader import ConfigReader

initializer = Initialize()
config_file = initializer.config_file
config_reader = ConfigReader(config_file)


def main():
    parser = argparse.ArgumentParser(add_help=True, allow_abbrev=False)
    group = parser.add_mutually_exclusive_group()
    group.add_argument('-d',
                       '--directory',
                       metavar='DIR',
                       nargs=1,
                       help='backup location')
    group.add_argument('-dh',
                       '--dhelp',
                       action='store_true',
                       help='displays detailed help for this hacker-script')
    args = parser.parse_args()
Пример #13
0
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.  #
#############################################################################

# Python imports
import ctypes
import os
import random

# Local imports
from src.errors import *
from src.initialize import Initialize
from src.configreader import ConfigReader

initializer = Initialize()
config_file = initializer.config_file
config_reader = ConfigReader(config_file)
main = initializer.basic_main
# Gets a list of all the wallpapers in the directories (in the config file)
# and in their sub-directories as well
wallpapers = config_reader.read_config("hs-wallpaper")


def execute():
    if wallpapers:
        # Chooses a random wallpaper from the list of wallpapers
        random_wallpaper = random.choice(wallpapers)
        print(" Setting", os.path.basename(random_wallpaper), "as desktop wallpaper...")
        SPI_SETDESKWALLPAPER = 20
        ctypes.windll.user32.SystemParametersInfoW(
            SPI_SETDESKWALLPAPER,
            0,
Пример #14
0
#    GNU General Public License for more details.                           #
#                                                                           #
#    You should have received a copy of the GNU General Public License      #
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.  #
#############################################################################

# Python imports
import webbrowser

# Local imports
from src.initialize import Initialize
from src.configreader import ConfigReader

initializer = Initialize()
config_file = initializer.config_file
config_reader = ConfigReader(config_file)
main = initializer.basic_main

# List of URLs to open (will be filled later)
urls = config_reader.read_config("hs-browse")


def execute():
    for url in urls:
        print(" Opening", url)
        # Opens the URL with the default browser
        webbrowser.open(url)

if __name__ == "__main__":
    main(execute)