This file contains 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 argparse | |
import sys | |
from pathlib import Path | |
import yaml | |
from lxml import etree | |
def resource_path(*args:str) -> Path: | |
base_path = '' |
This file contains 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 lxml import etree | |
parser = etree.XMLParser( remove_blank_text=True) | |
tree = etree.parse('data/xml/data.xml', parser) | |
for addr in tree.xpath('//PurchaseOrder'): | |
ver_el = etree.Element('version') | |
ver_el.text = 'xxxx' | |
addr.insert(0, ver_el) |
This file contains 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
# generated by Git for Windows | |
test -f ~/.profile && . ~/.profile | |
test -f ~/.bashrc && . ~/.bashrc | |
env=~/.ssh/agent.env | |
agent_load_env() { | |
test -f "$env" && . "$env" >| /dev/null | |
} |
This file contains 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
RED="\[\033[0;31m\]" | |
GREEN="\[\033[0;32m\]" | |
YELLOW="\[\033[0;33m\]" | |
BLUE="\[\033[0;34m\]" | |
PURPLE="\[\033[0;35m\]" | |
CYAN="\[\033[0;36m\]" | |
LIGHT_GRAY="\[\033[1;30m\]" | |
LIGHT_RED="\[\033[1;31m\]" | |
LIGHT_GREEN="\[\033[1;32m\]" |
This file contains 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
# https://github.com/Tinche/cattrs | |
# https://pypi.org/project/cattrs/ | |
import json | |
from dataclasses import dataclass | |
from typing import Dict, Optional, Union | |
from cattr import register_structure_hook, structure | |
This file contains 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 os | |
import re | |
def rename_action(args: any): | |
print('--------------------') | |
print(os.path.abspath(args.root) + ' :') | |
print('--------------------') | |
pathlist = [] | |
listup(args, pathlist) |
This file contains 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 wx | |
import ctypes | |
import logging | |
import wx | |
class FileDropToObject(wx.FileDropTarget): | |
def __init__(self, target): | |
wx.FileDropTarget.__init__(self) | |
self.target = target |
This file contains 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 re | |
from functools import reduce | |
def set_attr(obj, keystr, value, delimiter='.'): | |
key_list = keystr.split(delimiter) | |
o, k = _set_parse_keystr(obj, key_list) | |
o[k] = value | |
print(' -+', o[k]) | |
return obj |
This file contains 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 base64 | |
import os | |
import sys | |
def basestr_to_file(s, outfile_path): | |
with open(outfile_path, "wb") as f: | |
f.write(base64.b85decode(s)) | |
if __name__ == "__main__": | |
args = sys.argv |
This file contains 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 base64 | |
import os | |
import sys | |
def file_to_basestr(file_path): | |
with open(file_path, "rb") as f: | |
return base64.b85encode(f.read()) | |
if __name__ == "__main__": | |
args = sys.argv |
NewerOlder