def main(): ## {{{ getopts() print(Color().heading(title)) main_items = [ 'single', 'bulk', 'get youtube playlist urls', 'video available formats', 'help' ] main_item = fzf(main_items) if main_item == 'single': total_duration = single() print(Color().brown({ 'time': get_datetime('jhms'), 'total duration': total_duration })) elif main_item == 'bulk': total_duration = bulk() append_to_log( str({ 'time': get_datetime('jhms'), 'total duration': total_duration }) + '\n') print(Color().brown({ 'time': get_datetime('jhms'), 'total duration': total_duration })) elif main_item == 'get youtube playlist urls': get_youtube_playlist_urls() elif main_item == 'video available formats': video_available_formats() elif main_item == 'help': help()
## with no symbols print('no symbols:') up, lo, di, sy = True, True, True, False letters = '' if up: letters += u if lo: letters += l if di: letters += d if sy: letters += s if length > len(letters): print(Color().orange(f'Length exceeded maximumm number.\nLength is {len(letters)} now.')) length = len(letters) for x in range(5): password = ''.join(sample(letters, length)) print(password) ## }}} getopts() print(Color().heading(title)) main_items = ['password', 'help'] main_item = fzf(main_items) if main_item == 'password': prompt('-l') generate() elif main_item == 'help': help()
from magic import Magic from gp import (Color, msgn, msgc, get_datetime, get_single_input, invalid, dorm, get_password, fzf, compress_tar, compress_zip, xtract_tar, xtract_zip, xtract_rar) script_args = argv[1:] main_arg = script_args[0] files = script_args[1:] if main_arg == 'chattr': main_items = [ 'mutable', 'immutable', 'deletable', 'undeletable', 'delete normal', 'delete secure', 'lsattr' ] main_item = fzf(main_items, 'chattr') if main_item == 'mutable': for f in files: _, base = path.split(f) cmd = run(f'sudo chattr -R -i {base}', shell=True, universal_newlines=True, capture_output=True) cmd_error = cmd.stderr.strip() if not cmd_error: if path.isdir(base): attribution = check_output( f'lsattr {base}', shell=True, universal_newlines=True).strip() else: attribution = check_output(
#!/usr/bin/env python from os import path, listdir, getenv, chdir from clipboard import copy as clipboard_copy from gp import Color, fzf, msgn title = path.basename(__file__).replace('.py', '') chdir(f'{getenv("HOME")}/linux/emojis') print(Color().heading(title)) main_items = listdir() main_item = fzf(main_items) print(main_item) with open(main_item, 'r') as FILE: all_content = FILE.read().strip().split('\n') lines = list(filter(lambda line: not line.startswith('#'), all_content)) ## remove comments line = fzf(lines) emoji = line.split()[0] clipboard_copy(emoji) msgn(f'copied <span color=\"{getenv("orange")}\">{emoji}</span>')